Mfsort — Mainframe Sort/Merge & ICETOOL Emulation
In IBM mainframe z/OS batch processing, high-volume data transformation, sequencing, record filtering, and report generation are predominantly executed by sorting utilities like IBM DFSORT or Syncsort (invoked via EXEC PGM=SORT or PGM=SYNCSORT), alongside reporting utilities like ICETOOL. [1]
Read the full briefing
1. Capability Overview & Problem It Solves
In IBM mainframe z/OS batch processing, high-volume data transformation, sequencing, record filtering, and report generation are predominantly executed by sorting utilities like IBM DFSORT or Syncsort (invoked via EXEC PGM=SORT or PGM=SYNCSORT), alongside reporting utilities like ICETOOL.
Production batch jobstreams rely heavily on sophisticated control cards—including SORT FIELDS, MERGE, INCLUDE/OMIT, INREC/OUTREC, SUM FIELDS, and OUTFIL—to slice record buffers, aggregate numeric fields, deduplicate datasets (SUM FIELDS=NONE), and generate multiple target reports in a single I/O pass.
When migrating to distributed open systems, attempting to rewrite thousands of sorting steps into custom SQL queries or script-based utilities risks severe batch window expansion, introduces data formatting discrepancies, and breaks standard JCL restartability.
Rocket Enterprise Server and Enterprise Developer deliver native Mfsort (and MFJSORT) emulation (Field Types - Rocket Software Documentation, SUM - Rocket Software Documentation). Mfsort interprets and executes DFSORT, SYNCSORT, and ICETOOL control statements directly within JCL batch streams, COBOL internal SORT verbs, and command-line scripts without modifying control cards or application code.
2. Architecture & How It Works
- Dual Engine Emulation (DFSORT & SYNCSORT):
- Controlled automatically or explicitly via the
MFJSENGINEenvironment variable (set toDFSORTorSYNCSORT) (SUM - Rocket Software Documentation). - Fully emulates mainframe control statements:
SORT,MERGE,INCLUDE,OMIT,INREC,OUTREC,OUTFIL, andALTSEQ(alternative collating sequence tables) (ALTSEQ (DFSORT) - Rocket Software Documentation). - SYNCSORT compatibility mode relaxes delimiter strictness, supporting syntax without explicit equals signs (e.g.,
OUTREC(05:5,10)) (END - Rocket Software Documentation).
- Controlled automatically or explicitly via the
- Comprehensive Mainframe Field Formats: Mfsort provides native parsing for binary and decimal data types without requiring EBCDIC-to-ASCII conversion steps (Field Types - Rocket Software Documentation):
- Character & Binary:
CH(character),BI(binary),FI(fixed-point integer),FL(floating point). - Decimal Formats:
PD(packed decimal /COMP-3),ZD(zoned decimal),CSF/CSL(signed decimal with floating/leading sign). - Century & Date Handling: Full support for two-digit and century-windowed date types (
Y2B,Y2C,Y2D,Y2P,Y2S,Y2T, etc.) to preserve legacy date comparisons.
- Character & Binary:
- Deduplication & Summation (
SUM FIELDS):- Deduplication: Coding
SUM FIELDS=NONEeliminates duplicate records that share identical sort keys. Dropped duplicate records can be intercepted and routed to a dedicated dataset via the standard//SORTXSUM DDstatement (SUM - Rocket Software Documentation). - Field Summing: Allows up to 600 distinct numeric summary fields to be totaled across matching keys, consolidating detail records into summary balances in a single pass.
- Deduplication: Coding
- ICETOOL Reporting Utilities: Mfsort delivers drop-in compatibility for IBM ICETOOL operators (
COPY,COUNT,DISPLAY,OCCUR,RANGE,RESIZE,SELECT,SPLICE,SORT,STATS,UNIQUE), enabling automated record counting, range analysis, and multi-file record splicing (COUNT (ICETOOL Emulation) - Rocket Software Documentation). - Memory & Workfile Management: Sort operations execute in high-speed host memory up to allocated limits, automatically spilling into temporary workfiles (
SORTWK01throughSORTWKnn) for multi-gigabyte or terabyte dataset sorts without memory exhaustion (Workfile - Rocket Software Documentation).
3. Key Syntax, Configuration & Operational Directives
- JCL Batch Execution of DFSORT Control Cards:
//SRTSTEP JOB (ACCT),'SORT DATA',CLASS=A,MSGCLASS=X
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=PROD.CUSTOMER.TRANSACTIONS,DISP=SHR
//SORTOUT DD DSN=PROD.CUSTOMER.SUMMARY,DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=120)
//SORTXSUM DD DSN=PROD.CUSTOMER.DUPLICATES,DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
SORT FIELDS=(1,10,CH,A,25,8,PD,D)
INCLUDE COND=(15,2,CH,EQ,C'NY',OR,15,2,CH,EQ,C'NJ')
INREC FIELDS=(1,50,DATE1,C' ',51,40)
SUM FIELDS=NONE
/*- Selecting Sort Engine via Environment Variables: In ESCWA (Enterprise Server Common Web Administration) under
Region Properties > Environment Variablesor batch initiator profiles (SUM - Rocket Software Documentation):
# Select DFSORT emulation engine
MFJSENGINE=DFSORT
export MFJSENGINE- Standalone Command-Line Execution (
mfsort): Developers can test sort routines or execute standalone sorting outside of JCL via shell scripts:
# Execute sort from a parameter control file
mfsort take sort_params.txt
# Direct command-line syntax
mfsort sort fields=\(1,8,ch,a\) use input.dat org sq give output.dat4. Reference Citations (Rocket Documentation 12.0)
- Field Types - Rocket Software Documentation — Enterprise Server 12.0 for UNIX
- SUM - Rocket Software Documentation — Enterprise Server 12.0 for UNIX
- COUNT (ICETOOL Emulation) - Rocket Software Documentation — Enterprise Server 12.0 for UNIX
- Workfile - Rocket Software Documentation — Enterprise Server 12.0 for UNIX
- ALTSEQ (DFSORT) - Rocket Software Documentation — Enterprise Server 12.0 for UNIX
- END - Rocket Software Documentation — Enterprise Server 12.0 for UNIX