Syncsort — File Split
Overview
How to use SYNCSORT to split files into multiple output datasets using SKIPREC, STOPAFT, and OUTFIL parameters.
Key Parameters
SKIPREC
SKIPREC=n instructs the sort to skip a decimal number n of records before sorting/copying the input file. Records that are skipped are removed before E15 and INCLUDE/OMIT processing begins.
STOPAFT
STOPAFT=n sorts/copies at most n records. These represent the first n records following any input processing from E15, INCLUDE/OMIT, or SKIPREC parameters.
Limitations
- Both take precedence over SORT/MERGE control statement specifications
- Incompatible with merge operations unless using FIELDS=COPY
- Cannot be used with tape sort
Control Card Logic
The SYSIN member uses OUTFIL with OMIT conditions to route records to specific files based on field values. For example:
OUTFIL FILES=02,OMIT=(36,6,PD,EQ,0),OUTREC=(36,74)
This directs non-zero packed-decimal values from position 36-41 to file 02 with a 74-byte record length. This technique efficiently distributes records across multiple datasets in a single pass.