View previous topic :: View next topic |
Author |
Message |
gps_94 Beginner
Joined: 03 Aug 2018 Posts: 4 Topics: 2
|
Posted: Fri Aug 03, 2018 3:48 pm Post subject: Extract record based on Seq No (HEX) & Key 3 using SORT |
|
|
Hi,
I have a below requirement and need a solution for this using DFSORT/any other utility
Code: |
XXXX ____2018-08-01-13.49.53.655020Y123456 A B
YYYY ____2018-08-01-13.52.31.311231Y123456 C B
YYYY ____2018-08-01-13.52.31.311231Y123456 C D
|
File length is 81 and its fixed
Y123456 is the key
The ____(Spaces) between XXXX/YYYY and timestamp has a sequence no (Type: INTEGER) but its not visible. Once I turn HEX ON and it has value 0001,0002,0003 for record 1,2 &3 respectively.
I need to extract record which has maximum sequence no for distinct keys (Sequence No 3 & Key Y123456 in this case)
I am not sure how many records will be there in input file for a given key.
Output should be:
Code: |
YYYY ____2018-08-01-13.52.31.311231Y123456 C D
|
Thanks ! _________________ Mainframe Developer |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Fri Aug 03, 2018 4:50 pm Post subject: |
|
|
gps_94,
You can use the following DFSORT/ICETOOL JCL which will give you the desired results.
I assumed that your Key Y123456 is at position 36 for a length of 7 bytes and the sequence number is at position 6 for a length of 4 bytes.
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DISP=SHR,DSN=Your Input file
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(36,7,CH) FIRST USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=(36,7,CH,A,
06,4,FI,D)
/* |
The output would be
Code: |
YYYY 2018-08-01-13.52.31.311231Y123456 C D |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
gps_94 Beginner
Joined: 03 Aug 2018 Posts: 4 Topics: 2
|
Posted: Fri Aug 03, 2018 5:16 pm Post subject: |
|
|
Thanks a lot Kolusu .
Also, if you can tell me how we can achieve this using DFSORT instead of using SYNCSORT. _________________ Mainframe Developer |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Fri Aug 03, 2018 5:25 pm Post subject: |
|
|
gps_94 wrote: | Thanks a lot Kolusu .
Also, if you can tell me how we can achieve this using DFSORT instead of using SYNCSORT. |
gps_94,
DFSORT and Syncsort are competitive products. I'm a DFSORT developer. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Sat Aug 04, 2018 3:34 am Post subject: |
|
|
That WAS a DFSort solution! _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
|
|