Sort - Examples
Sort - Examples
This document contains the few control statements, we have discussed during the
session with examples.
The given files are the input files used in all the below given examples
SORT FIELDS:
INCLUDE COND
OMIT COND
INREC FIELDS:
INREC adds, deletes, or reformats fields before the records are sorted or
merged. so that performance will be improved
OUTREC adds, deletes, or reformats fields after the records are sorted or
merged.
SUM FIELDS:
//SYSIN DD *
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=NONE,XSUM
/*
//SYSOUT DD SYSOUT=*
//*
Here,
SUM FIELDS=NONE means it will eliminate duplicates
XSUM options will copy all records eliminated in sort process will copy to
another data set defined in SORTXSUM step
OUTFIL Control Statement:
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=01,INCLUDE=(1,6,CH,EQ,C'MOHANK')
OUTFIL FILES=02,INCLUDE=(1,6,CH,EQ,C'SURESH')
/*
//SYSOUT DD SYSOUT=*
//*
sort examples.zip