DFSORT
The sort program. It also picks records, reshapes them and totals them, not only puts them in order.
Also written SORT, SYNCSORT, sort utility
Why it matters. A sort step is often faster and simpler than a program. The bank uses it to clean and prepare files between steps.
See it
SORT runs DFSORT, the IBM sort program.
Syntax
//STEP1 EXEC PGM=SORT //SORTIN DD DSN=input,DISP=SHR //SORTOUT DD DSN=output,DISP=(NEW,CATLG) //SYSOUT DD SYSOUT=* //SYSIN DD *
- SORT FIELDS
- Put records in order, or COPY to keep the order.
- INCLUDE / OMIT
- Keep, or drop, records that match a test.
- INREC / OUTREC
- Reshape records before or after the sort.
- SUM FIELDS
- Add up numbers for records with the same key, or drop duplicates with NONE.
- OUTFIL
- Write several outputs, or a report.
- MERGE
- Combine files that are already sorted.
Try it INCLUDE COND
- 1
You're in the SYSIN lines of job KEEPA, under a line that says SORT FIELDS=COPY. Write the statement that keeps only the records that have the letter A in column 1.
SYSIN INCLUDE COND=(1,1,CH,EQ,C'A') - 2
Submit the job KEEPA from your DEV JCL library.
SUBMIT 'ZB0001.DEV.JCL(KEEPA)' - 3
Read the DFSORT messages, STEP1.SYSOUT. Find how many records came out.
OUTPUT KEEPA STEP1.SYSOUT
Remember
- DFSORT sorts, but also selects, reformats, merges and totals.
- Its statements go in SYSIN. Its messages go to SYSOUT.
- ICE054I shows records in and out.
The usual mistake
INCLUDE COND=(1,1,CH,EQ,'A')
The value is text, so it needs C and quotes: C'A'. Without the C, DFSORT cannot read the value.
INCLUDE COND=(1,1,CH,EQ,C'A')
On real z/OS
MF/OS runs a real subset of DFSORT: sorting, selecting, reshaping, SUM and OUTFIL without report features. ICE000I carries MF/OS SORT in place of the product name, and ICE751I is fixed text. Many real sites replace IEBGENER with DFSORT's ICEGENER, and ICETOOL sits beside it for counts and checks.
Where can I practise DFSORT?
Right here, at ZedBank. You take a junior job at a simulated bank and use DFSORT in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- Utility programA supplied program that performs a standard job such as copying, sorting, comparing or managing datasets, driven by control statements.
- Sequential datasetThe simplest kind of dataset: records stored one after another and normally read from start to finish.
- JCLJob Control Language: the language used to tell the mainframe what programs to run, in what order, and with what files.
- Batch processingRunning work in bulk, without anyone watching, usually on a schedule. The overnight run that settles a day of transactions.