Skip to content
JCL & batch

DFSORT

The standard sort utility, used far beyond sorting to select, merge, reformat and summarise records at speed.

Also written SORT, SYNCSORT, sort utility

DFSORT is IBM's sort product, and its equivalents from other vendors work much the same way. Its name undersells it: sorting is the least of what it does in practice.

The obvious use is ordering records by one or more fields. Beyond that, it selects records matching conditions, drops the rest, merges already-sorted files, removes duplicates, rearranges fields into a different layout, adds constants, and produces totals and counts.

This matters because a sort step is often faster and simpler than writing a program to do the same thing. A great deal of production batch consists of sort steps doing work that looks like it should need code.

Control statements go in on a DD statement, and the input and output datasets use conventional names: SORTIN for input, SORTOUT for output. Statements such as SORT, INCLUDE, OMIT and OUTREC cover most requirements.

Learning a little of it early is one of the highest-value things a batch newcomer can do, because it comes up constantly.

Browse all 115 terms

Learn this properly.

Use DFSORT for real in Mainframe101, in your browser, with Zed beside you. Join the waitlist.

Early access and updates. No spam, unsubscribe any time.