Easytrieve vs DFSORT

DFSORT (Data Facility Sort) is IBM's sort, merge, and copy utility. Easytrieve is a compiled report generator. Both process mainframe datasets in batch; they overlap on sort and filter but diverge on formatted reporting and development model. Choosing wrong costs either maintenance pain (all DFSORT for a multi-level report) or unnecessary compile cycles (Easytrieve for a plain sort).

Progress0 of 0 lessons

Fundamental Difference

DFSORT is a utility: you supply control statements in SYSIN, no compile, immediate rerun when keys change. Easytrieve is a language: you compile source to a load module, then execute. DFSORT thinks in records and keys; Easytrieve thinks in files, fields, and report lines with control breaks.

Easytrieve vs DFSORT comparison
AspectEasytrieveDFSORT
InvocationCompile + EXEC load moduleEXEC PGM=SORT, SYSIN cards
Primary outputFormatted reports and extractsSorted/merged/copied datasets
Sort performanceGood; not specialized sort engineIndustry-tuned for massive sorts
Control breaksNative CONTROL/SUM/TOTALRequires SUM, OUTFIL, or post-process
Change cycleEdit source, recompileEdit SYSIN, rerun job
Join filesActivity logic or pre-mergeJOINKEYS in one step
LicenseBroadcom product licenseIncluded with z/OS

When to Use DFSORT

  • Sort or merge large files by one or more keys—especially when order is the only goal.
  • Copy with INCLUDE/OMIT filtering without report formatting.
  • Reformat records with INREC/OUTREC before or after sort.
  • Remove duplicates and add numeric fields with SUM.
  • Join two files with JOINKEYS inner/left/right/full outer.
  • Split one input into many outputs with OUTFIL.

When to Use Easytrieve

  • Printed or PDF-bound reports with titles, headings, detail, and footers.
  • Multiple control-break levels with subtotals and grand totals.
  • Conditional detail lines based on several field relationships.
  • Extracts where layout and calculated fields matter beyond sort order.
  • Programs maintained by report analysts who do not edit DFSORT control cards daily.

Example: Sort-Only Task

Sort 80-byte records by bytes 1–10 ascending—DFSORT is the natural choice:

jcl
1
2
3
4
5
6
7
//SORT1 EXEC PGM=SORT //SORTIN DD DSN=INPUT.DATA,DISP=SHR //SORTOUT DD DSN=OUTPUT.SORTED,DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(5,1)),DCB=(RECFM=FB,LRECL=80) //SYSIN DD * SORT FIELDS=(1,10,CH,A) /*

SORT FIELDS=(1,10,CH,A) sorts character data starting position 1 length 10 ascending. No program source, no link-edit. Changing to descending is one character (D instead of A).

Example: Report with Subtotals

Same sorted data, but you need department subtotals and a title—Easytrieve fits better:

text
1
2
3
4
5
6
7
8
9
10
FILE INFILE DEPT-CODE 1 4 A EMP-NAME 5 20 A AMOUNT 25 7 P 2 REPORT DEPT-RPT TITLE 'Department Listing' CONTROL DEPT-CODE LINE DEPT-CODE EMP-NAME AMOUNT TOTAL AMOUNT

TITLE prints a report heading. CONTROL DEPT-CODE breaks when the department changes. TOTAL AMOUNT accumulates within each break. Replicating this layout purely in DFSORT requires OUTFIL sections, SUM, and header/trailer constants—possible but harder to read and maintain.

Combined Pipeline (Best Practice)

Production jobs often chain both tools:

  1. DFSORT sorts or filters to reduce volume before reporting.
  2. Easytrieve reads the sorted file and produces the business report.
  3. Optionally DFSORT copies Easytrieve extract to a downstream system.

Splitting work leverages DFSORT's sort speed and Easytrieve's report semantics. Easytrieve internal SORT statements exist but for very large files external DFSORT is often faster and easier to tune with SORTWK datasets.

Feature Overlap and Gaps

Who handles what
TaskUsually better choiceNote
Pure sort 100M recordsDFSORTTuned buffers and work files
Green-bar reportEasytrieveREPORT section purpose-built
Dedupe and sum amountsDFSORT SUMSingle pass after sort
Multi-level subtotalsEasytrieveNested CONTROL levels
Join two large filesDFSORT JOINKEYSEasytrieve may pre-merge in activity
Quick key change tonightDFSORTNo recompile

Explain It Like I'm Five

DFSORT is like putting cards in order really fast—it shuffles giant stacks by number but does not write a story about them. Easytrieve reads the cards and writes a neat notebook page with chapter headings and add-up sums. Sometimes you use DFSORT first to sort the cards, then Easytrieve to write the notebook.

Exercises

  1. Write DFSORT SYSIN to sort by bytes 21–30 descending.
  2. Describe a job that needs both DFSORT and Easytrieve steps.
  3. When would SUM in DFSORT replace an Easytrieve TOTAL?
  4. List two tasks that should never be forced into Easytrieve alone.
  5. Compare change turnaround: DFSORT SYSIN edit vs Easytrieve recompile.

Quiz

Test Your Knowledge

1. DFSORT is invoked from JCL with PGM=

  • EZTPA00
  • SORT or ICEMAN
  • IKJEFT01
  • IDCAMS

2. For a simple sort by one key with no report headings, the fastest choice is often:

  • Easytrieve REPORT section
  • DFSORT SORT FIELDS
  • COBOL SCREEN SECTION
  • ISPF edit

3. Easytrieve is better than DFSORT when you need:

  • Raw sort speed on huge files only
  • Control-break subtotals and formatted report pages
  • Copy with no processing
  • Merge of two sorted files only

4. Can Easytrieve and DFSORT appear in the same job?

  • No
  • Yes—sort with DFSORT then report with Easytrieve
  • Only on Linux
  • Only with CICS

5. DFSORT OUTFIL is most similar to Easytrieve's ability to:

  • Define multiple formatted outputs or split records
  • Compile SCREEN sections
  • Run SQL cursors
  • Replace JCL entirely
Published
Read time10 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: IBM DFSORT documentation and Broadcom Easytrieve TechDocsSources: IBM DFSORT User Guide, Broadcom Application Guide, JCL sort utility tutorialsApplies to: z/OS batch sort and report workflows