Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Itanium,
You can very easily combine all the 4 files together using the new when=group function. Since you did not provide me with any details , I assumed that there is no indicator in the files to identify from which file the record came from.
So inorder to identify the records, we concatenate a 1 line HDR record before each file and use the GROUP function to tag the records and append a sequence number to them.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
HDR
// DD *
FILE1-REC-01
FILE1-REC-02
// DD *
HDR
// DD *
FILE2-REC-01
FILE2-REC-02
// DD *
HDR
// DD *
FILE3-REC-01
FILE3-REC-02
// DD *
HDR
// DD *
FILE4-REC-01
FILE4-REC-02
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(49:1,12)),
IFTHEN=(WHEN=GROUP,BEGIN=(49,3,CH,EQ,C'HDR'),PUSH=(61:ID=1,SEQ=8))
SORT FIELDS=(62,8,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(61,1,ZD,EQ,1),
PUSH=(01:49,12),RECORDS=4),
IFTHEN=(WHEN=GROUP,BEGIN=(61,1,ZD,EQ,2),PUSH=(13:49,12),RECORDS=3),
IFTHEN=(WHEN=GROUP,BEGIN=(61,1,ZD,EQ,3),PUSH=(25:49,12),RECORDS=2),
IFTHEN=(WHEN=GROUP,BEGIN=(61,1,ZD,EQ,4),PUSH=(37:49,12))
OUTFIL INCLUDE=(62,8,ZD,GT,1),BUILD=(48X),
REMOVECC,NODETAIL,SECTIONS=(62,8,TRAILER3=(1,48))
/* |
The output from this job is
Code: |
FILE1-REC-01FILE2-REC-01FILE3-REC-01FILE4-REC-01
FILE1-REC-02FILE2-REC-02FILE3-REC-02FILE4-REC-02
|
|
|