Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
maxsubrat,
Since you haven't provided the LRECL and REFCM of the input and output files, here is a DFSORT JOB which would give you the desired results based on the assumptions
1. Your Input is FB recfm and has an LRECL of 80
2. The header value gets the first detail record value from pos 26 for a length of 9 bytes
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
H|ACD1384738 |2009-10-01|023
D|ACD1384738 |2009-10-01|023395620
D|ACD1384738 |2009-10-01|023395620
H|ACD1384743 |2009-10-01|023
D|ACD1384743 |2009-10-01|023395624
D|ACD1384743 |2009-10-01|023395624
H|ACD1384756 |2009-10-01|023
D|ACD1384756 |2009-10-01|023395628
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'H'),
PUSH=(81:1,80),RECORDS=2)
OUTFIL IFOUTLEN=80,OMIT=(1,1,CH,EQ,C'H'),
IFTHEN=(WHEN=(81,1,CH,EQ,C'H'),BUILD=(81,25,26,9,115,46,/,1,80))
//* |
|
|