Monday, September 26, 2011

SORT: combining every two lines from input file

The below sample SORT job combines every two records into a single record.

Assuming that the input file Lrecl is 80, then the following JCl will give us the desired results. we simply override the Lrecl for the input .code it as twice the lrecl

//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR.INPUT.DSN,
// DISP=SHR,
// DCB=(RECFM=FB,LRECL=160)
//SORTOUT DD DSN=YOUR.OUTPUT.DSN,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE),
// DCB=(RECFM=FB,LRECL=160,BLKSIZE=0),
//SYSIN DD *
SORT FIELDS=COPY
/*
The solution  will only work if the true BLKSIZE of the input is an EVEN multiple of the true LRECL. If it is an ODD multiple, we will abend with an S013 abend ( BLKSIZE not a multiple of LRECL ) when you overide the LRECL. If this is the case, you must first copy the original dataset and force the output LRECL to be an even multiple of the LRECL, then apply suggestion to that intermediate file.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.