Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Venkata Perumala,
The following DFSORT JCL will give you the desired results. We basically mimic the function of split using INREC. Since we are splitting the input into 5 files we add a 8 byte sequm at the end in pd format with a start number of 5, and then divide that seqnum by 5 and get the remainder. So the first record will have a remainder of 0 and the second record will have a remainder of 1, the third record will have a remainder of 2, the fourth record will have remainder of 3 and the 5th record will have a remainder of 4 and the 6th record once again will have a remainder of zero and the cycle of 5 records continues till the end.
Now using this number we start another seqnum on outrec to count the no: of records written to the output. We start with count of 0 because you dont want the trailer record to be counted as part of the total no:f records.
Using OUTFIL we split the records into different based on the remainder and while writting out we overlay the contents of the trailer records with the seqnum we added using outrec.
Code: |
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR INPUT DSN TO BE SPLIT,DISP=SHR
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//OUT3 DD SYSOUT=*
//OUT4 DD SYSOUT=*
//OUT5 DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(701:SEQNUM,8,PD,START=5,INCR=1,
701,8,PD,MOD,+5,TO=ZD,LENGTH=1))
OUTREC IFTHEN=(WHEN=(709,1,ZD,EQ,0,OR,1,7,CH,EQ,C'TRAILER'),
OVERLAY=(710:SEQNUM,9,ZD,START=0,INCR=1),HIT=NEXT),
IFTHEN=(WHEN=(709,1,ZD,EQ,1,OR,1,7,CH,EQ,C'TRAILER'),
OVERLAY=(720:SEQNUM,9,ZD,START=0,INCR=1),HIT=NEXT),
IFTHEN=(WHEN=(709,1,ZD,EQ,2,OR,1,7,CH,EQ,C'TRAILER'),
OVERLAY=(730:SEQNUM,9,ZD,START=0,INCR=1),HIT=NEXT),
IFTHEN=(WHEN=(709,1,ZD,EQ,3,OR,1,7,CH,EQ,C'TRAILER'),
OVERLAY=(740:SEQNUM,9,ZD,START=0,INCR=1),HIT=NEXT),
IFTHEN=(WHEN=(709,1,ZD,EQ,4,OR,1,7,CH,EQ,C'TRAILER'),
OVERLAY=(750:SEQNUM,9,ZD,START=0,INCR=1))
OUTFIL FNAMES=OUT1,IFOUTLEN=700,
INCLUDE=(709,1,ZD,EQ,0,OR,1,7,CH,EQ,C'TRAILER'),
IFTHEN=(WHEN=(1,4,CH,EQ,C'TRAILER'),OVERLAY=(51:710,9))
OUTFIL FNAMES=OUT2,IFOUTLEN=700,
INCLUDE=(709,1,ZD,EQ,1,OR,1,7,CH,EQ,C'TRAILER'),
IFTHEN=(WHEN=(1,4,CH,EQ,C'TRAILER'),OVERLAY=(51:720,9))
OUTFIL FNAMES=OUT3,IFOUTLEN=700,
INCLUDE=(709,1,ZD,EQ,2,OR,1,7,CH,EQ,C'TRAILER'),
IFTHEN=(WHEN=(1,4,CH,EQ,C'TRAILER'),OVERLAY=(51:730,9))
OUTFIL FNAMES=OUT4,IFOUTLEN=700,
INCLUDE=(709,1,ZD,EQ,3,OR,1,7,CH,EQ,C'TRAILER'),
IFTHEN=(WHEN=(1,4,CH,EQ,C'TRAILER'),OVERLAY=(51:740,9))
OUTFIL FNAMES=OUT5,IFOUTLEN=700,
INCLUDE=(709,1,ZD,EQ,4,OR,1,7,CH,EQ,C'TRAILER'),
IFTHEN=(WHEN=(1,4,CH,EQ,C'TRAILER'),OVERLAY=(51:750,9))
/*
|
|
|