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).
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.
| Aspect | Easytrieve | DFSORT |
|---|---|---|
| Invocation | Compile + EXEC load module | EXEC PGM=SORT, SYSIN cards |
| Primary output | Formatted reports and extracts | Sorted/merged/copied datasets |
| Sort performance | Good; not specialized sort engine | Industry-tuned for massive sorts |
| Control breaks | Native CONTROL/SUM/TOTAL | Requires SUM, OUTFIL, or post-process |
| Change cycle | Edit source, recompile | Edit SYSIN, rerun job |
| Join files | Activity logic or pre-merge | JOINKEYS in one step |
| License | Broadcom product license | Included with z/OS |
Sort 80-byte records by bytes 1–10 ascending—DFSORT is the natural choice:
1234567//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).
Same sorted data, but you need department subtotals and a title—Easytrieve fits better:
12345678910FILE 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.
Production jobs often chain both tools:
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.
| Task | Usually better choice | Note |
|---|---|---|
| Pure sort 100M records | DFSORT | Tuned buffers and work files |
| Green-bar report | Easytrieve | REPORT section purpose-built |
| Dedupe and sum amounts | DFSORT SUM | Single pass after sort |
| Multi-level subtotals | Easytrieve | Nested CONTROL levels |
| Join two large files | DFSORT JOINKEYS | Easytrieve may pre-merge in activity |
| Quick key change tonight | DFSORT | No recompile |
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.
1. DFSORT is invoked from JCL with PGM=
2. For a simple sort by one key with no report headings, the fastest choice is often:
3. Easytrieve is better than DFSORT when you need:
4. Can Easytrieve and DFSORT appear in the same job?
5. DFSORT OUTFIL is most similar to Easytrieve's ability to: