Fill these in once
- Sort by the first 10 characters
//SORT EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DSN=MYUSER.INPUT,DISP=SHR //SORTOUT DD DSN=MYUSER.SORTED,DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(1,1)),UNIT=SYSDA,DCB=*.SORTIN //SYSIN DD * SORT FIELDS=(1,10,CH,A) /*1,10 means start at column 1, 10 characters long. A is ascending, D descending.
- Keep only some records (replace the SYSIN lines)
INCLUDE COND=(11,2,CH,EQ,C'NY') SORT FIELDS=COPYKeeps records with NY in columns 11 and 12, without sorting.
- Remove duplicate records (replace the SYSIN lines)
SORT FIELDS=(1,10,CH,A) SUM FIELDS=NONEKeeps one record for each key in columns 1 to 10.