MainframeMaster

z/OS Sort Subsystem Basics

On z/OS, the "sort subsystem" is the set of programs and services that perform sorting, merging, copying, and related data operations in batch jobs. IBM supplies DFSORT (Data Facility Sort), which you invoke with program names such as SORT or ICEMAN. This page covers the basics: what the sort subsystem is, how it is invoked, and a few important rules.

Fundamentals
Progress0 of 0 lessons

What Is the Sort Subsystem?

On z/OS, many batch jobs need to sort or merge data. Rather than every application implementing its own sort, the operating system (or an installed product) provides a sort subsystem: a standard program that reads input from defined datasets, processes it according to control statements, and writes output. When people say "the sort subsystem" on z/OS, they usually mean the program that runs when you execute a sort step—typically DFSORT (IBM) or a licensed alternative such as Syncsort.

The sort subsystem is not a separate address space or server that stays running; it is the sort program that runs as one or more steps in your batch job. Each time your JCL runs EXEC PGM=SORT (or PGM=ICEMAN), that step invokes the sort subsystem program.

Program Names: SORT and ICEMAN

DFSORT is invoked by program name in the JCL EXEC statement. The two common names are:

  • SORT — The traditional name. EXEC PGM=SORT runs the sort program.
  • ICEMAN — Another name for the same program. EXEC PGM=ICEMAN does the same thing as PGM=SORT.

Both names point to the same DFSORT program. Which one your shop uses is convention (and possibly what is in the load library). If your site uses a third-party sort (e.g. Syncsort), the same program names might be used to invoke that product instead, depending on library order (JOBLIB, STEPLIB). So the program name alone does not tell you which vendor's sort you are running; the messages in SYSOUT do (ICE for DFSORT, WER for Syncsort, etc.).

jcl
1
2
3
4
5
6
7
8
//SORTSTEP EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DSN=MY.INPUT,DISP=SHR //SORTOUT DD DSN=MY.OUTPUT,DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(5,2)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920) //SYSIN DD * SORT FIELDS=(1,20,CH,A) /*

Replacing PGM=SORT with PGM=ICEMAN in the same JCL runs the same sort product; only the name in the EXEC changes.

The ICE Prefix

IBM uses the three-character identifier ICE for the sort product. So:

  • DFSORT messages start with ICE (e.g. ICE000I, ICE001I). When you see ICE in the job log, you ran DFSORT.
  • Related program/module names start with ICE: ICEMAN (sort), ICETOOL (multi-operator utility), ICEGENER (copy utility).

This makes it easy to tell that the step is using IBM's sort product and to look up messages in IBM documentation (e.g. "ICE000I").

Related Programs: ICETOOL and ICEGENER

The sort "subsystem" on z/OS often includes more than one program:

  • ICEMAN / SORT — The main sort/merge/copy program (DFSORT). Does SORT, MERGE, INCLUDE, OMIT, INREC, OUTREC, OUTFIL, SUM, JOINKEYS, etc.
  • ICETOOL — A utility that uses DFSORT internally. You run PGM=ICETOOL and give it "operators" (e.g. COPY, SORT, SPLICE, COUNT, DISPLAY). It can run multiple operations in one step and is useful for reporting and multi-file tasks.
  • ICEGENER — A program that copies entire files (similar to IEBGENER) with performance improvements. It is a drop-in replacement for simple copy jobs.

So when we say "z/OS sort subsystem," we usually mean the program you run for sort/merge (SORT/ICEMAN), but the same product family includes ICETOOL and ICEGENER.

Important Rule: SORTIN and SORTOUT Must Differ

DFSORT (and typical sort products) require that SORTIN and SORTOUT point to different datasets. If they point to the same dataset, the program may overwrite input while still reading it, causing lost or incorrect data and possible abends (e.g. IEC036I). Always allocate a separate output dataset for SORTOUT. If you want to replace the input with sorted data, use a temporary or different output dataset, then in a later step (or job) copy or rename it over the original.

Explain It Like I'm Five

The sort subsystem is like a helper that only does one kind of job: putting things in order or mixing two already-ordered piles into one. You call the helper by a name (SORT or ICEMAN)—both names get the same helper. The helper has a badge that says "ICE" so you know it's the same company's helper. You must give the helper a different place to put the result than where the papers came from, or the papers could get mixed up or lost.

Exercises

  1. What are the two common program names used to invoke DFSORT in JCL? Are they the same program?
  2. How can you tell from the job log that you ran DFSORT and not another sort product?
  3. Why must SORTIN and SORTOUT be different datasets?
  4. What is ICETOOL and how does it relate to DFSORT?

Quiz

Test Your Knowledge

1. What is ICEMAN in relation to DFSORT?

  • A different product
  • A program name that invokes DFSORT
  • A control statement
  • An output format

2. Which message prefix indicates you are running DFSORT?

  • WER
  • CAS
  • ICE
  • SORT

3. Can SORTIN and SORTOUT point to the same dataset in DFSORT?

  • Yes, it is supported
  • No, it can cause lost data and errors
  • Only for MERGE
  • Only with OPTION COPY

4. What is ICETOOL in the z/OS sort subsystem?

  • A different sort product
  • A utility that uses DFSORT for multiple operations
  • A JCL keyword
  • A type of sort key

5. Do PGM=SORT and PGM=ICEMAN do the same thing?

  • No, they are different products
  • Yes, they invoke the same sort product
  • Only on certain z/OS levels
  • Only when STEPLIB is used