There are two ways to read the sequential file in reverse order
1. Using FileAid
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=T365T.T365F1.INPUT,DISP=SHR
//SORTOUT DD DSN=T365T.T365F1.OUTPUT,
// DISP=(NEW,CATLG,DELETE),LRECL=57,
// SPACE=(CYL,(1,2),RLSE),AVGREC=K
//SYSIN DD *
INREC FIELDS=(1,57,SEQNUM,8,ZD)
SORT FIELDS=(58,8,ZD,D)
OUTREC FIELDS=(1,57)
/*
//*
Input file:
Output file:
1. Using FileAid
//STEP0100 EXEC PGM=FILEAID
//SYSPRINT DD SYSOUT=*
//DD01 DD DSN=YOUR INPUT DATASET,DISP=SHR
//DD01O DD DSN=YOUR OUTPUT FILE IN REVERSE ORDER,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
$$DD01 COPYBACK
/*
2. Using SORT (Assuming LRECL of input file is 80 bytes)
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR INPUT DATASET,DISP=SHR
//SORTOUT DD DSN=YOUR OUTPUT FILE IN REVERSE ORDER,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
INREC FIELDS=(1,80,SEQNUM,8,ZD)
SORT FIELDS=(81,8,ZD,D)
OUTREC FIELDS=(1,80)
/*
Example:
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=T365T.T365F1.INPUT,DISP=SHR
//SORTOUT DD DSN=T365T.T365F1.OUTPUT,
// DISP=(NEW,CATLG,DELETE),LRECL=57,
// SPACE=(CYL,(1,2),RLSE),AVGREC=K
//SYSIN DD *
INREC FIELDS=(1,57,SEQNUM,8,ZD)
SORT FIELDS=(58,8,ZD,D)
OUTREC FIELDS=(1,57)
/*
//*
Input file:
Output file:
No comments:
Post a Comment