Build INCLUDE, OMIT, SORT FIELDS, and OUTREC BUILD from start, length, and format. Or paste cards you already have and read them in English. The sample job uses PGM=SORT, SORTIN, SORTOUT, SYSOUT, and SYSIN.
How to use it
Runs in your browser. Nothing is uploaded.
DFSORT helper
//SORTSTEP JOB (ACCT),'DFSORT',CLASS=A,MSGCLASS=X
//*
//* Change CLASS, MSGCLASS, and the dataset names for your shop.
//* PGM=SORT is the usual alias. PGM=ICEMAN calls DFSORT directly.
//*
//STEP010 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=USER.SORT.INPUT
//SORTOUT DD DISP=(NEW,CATLG,DELETE),
// DSN=USER.SORT.OUTPUT,
// SPACE=(CYL,(5,1)),UNIT=SYSDA
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(15,2,CH,EQ,C'NY')
SORT FIELDS=(1,10,CH,A)
OUTREC BUILD=(1,10,2X,15,2)
/*Need this at work?
Free account saves tutorial progress. The jobs board lists openings that ask for JCL.
DFSORT reads SORTIN, optionally reformats with INREC, then applies INCLUDE and OMIT, then sorts (unless you coded COPY), then writes. OUTREC changes the record during that write. OUTFIL can filter and rebuild again for a DD of its own. A position in OUTREC is a position in the record that survived the sort, which is the SORTIN layout only when you did not use INREC.
The format tells DFSORT how to compare or sort those bytes. The wrong format still runs. It just orders or filters on a different interpretation of the same storage.
Date formats such as Y2C and DT1 are real DFSORT formats. Explain mode names them. The builder stays on CH, ZD, PD, BI, and FI. For TOJUL and TOGREG, use the DFSORT date conversion pages.
123INCLUDE COND=(15,2,CH,EQ,C'NY') SORT FIELDS=(1,10,CH,A) OUTREC BUILD=(1,10,2X,15,2)
Keep records whose bytes 15 and 16 are NY. Sort the ten-byte character field at the front, ascending. Write those ten bytes, two blanks, then the state code.
IFTHEN, PARSE, FINDREP, OVERLAY, and edit masks (EDIT=, M4, and the like) show up as a short note, not a full reading. JOINKEYS, OUTFIL report headers, and most OPTION keywords beyond COPY, EQUALS, SKIPREC, STOPAFT, VLSHRT, DYNALLOC, and Y2PAST are in the same bucket. IBM documents the rest in the DFSORT Application Programming Guide.
SORTIN is a stack of cards. INCLUDE is a helper who keeps only the cards you asked for. SORT is the helper who puts the remaining cards in order. OUTREC is the helper who copies just the bits you want onto a new card, with blank spaces where you asked for them.
Field-by-field writeups live on the INCLUDE, OUTREC, and OUTFIL tutorials. Other calculators are on /tools.