//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTWK01 DD UNIT=DISK,SPACE=(CYL,(100,100))
//SORTIN DD *
1111111111111111111111111
2222222222222222222222222
3333333333333333333333333
4444444444444444444444444
5555555555555555555555555
6666666666666666666666666
//ODD DD DSN=TEST.ODD.OP1,
// DISP=(,CATLG),UNIT=TEST,
// SPACE=(CYL,(50,50),RLSE)
//EVEN DD DSN=TEST.EVEN.OP2,
// DISP=(,CATLG),UNIT=TEST,
// SPACE=(CYL,(50,50),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=(ODD,EVEN),SPLIT
//*
Here is the output of the ODD file:
******************************
1111111111111111111111111
3333333333333333333333333
5555555555555555555555555
******************************
Here is the output of the EVEN file:
**************************SPLIT parameter to put the first record into OUTPUT1, the second record into OUTPUT2, the third record into OUTPUT1, the fourth record into OUTPUT2, and so on until you run out of records. SPLIT splits the records one at a time among the data sets specified by FNAMES.
2222222222222222222222222
4444444444444444444444444
6666666666666666666666666
**************************
Other options SPLITBY and SPLIT1R are also available. Do check out the usage for further info.
The example is absolutely wrong.
ReplyDeleteThe SPLIT option will place every second record into the second file, etc. in a row.
It has nothing to do with the numerical (or non-numerical!) value stored in every record!
In order to really split odd, and even values, another SORT option is required.
OUTFIL FNAMES=ODD,INCLUDE=(field,size,ZD,MOD,+2,EQ,+1)
OUTFIL FNAMES=EVEN,SAVE
Thanks for the correction. Have updated the post.
Delete