SPLIT1R is an OUTFIL parameter that splits the output into multiple datasets in contiguous blocks. You specify SPLIT1R=n and a list of output DD names in FNAMES=(DD1,DD2,…,DDk). The first n records go to the first file, the next n to the second, and so on. When the total record count is not evenly divisible by n, the remainder typically goes to the last file. So you get one contiguous segment per file—no cycling back to the first file like SPLITBY. SPLIT1R is useful when you need roughly equal-sized output files in order (e.g. for parallel processing where each file is processed independently) or when downstream systems expect one range of records per file. This page covers SPLIT1R syntax, how remainder is handled, how it differs from SPLITBY and SPLIT, choosing n, and JCL requirements.
The "1R" in SPLIT1R is often read as "one round" or "one pass": each output file is filled once in order with a block of n records. There is no second round back to the first file. So with FNAMES=(OUT1,OUT2,OUT3) and SPLIT1R=1000:
If you have 2500 records, OUT1 gets 1000, OUT2 gets 1000, and OUT3 gets the remaining 500. The last file in the list gets the remainder. This makes SPLIT1R ideal when you want contiguous key ranges or record ranges per file (e.g. first third of sorted data in file1, second third in file2, last third in file3).
Code one OUTFIL with FNAMES= and SPLIT1R=n. All listed DD names must be defined in your JCL. The value n is the number of records per block (per file, for the first k-1 files; the last file may get n plus remainder).
12SORT FIELDS=COPY OUTFIL FNAMES=(OUT1,OUT2,OUT3),SPLIT1R=1000
This sends the first 1000 records to OUT1, the next 1000 to OUT2, and the next 1000 (and any remainder) to OUT3. You can list as many DD names as you need; each will receive one contiguous block of n records (except the last, which may receive the remainder).
If you want k output files with roughly the same number of records, set n to approximately (total records / k). For example, if you expect 9000 records and want three files, use SPLIT1R=3000. Then OUT1 gets 3000, OUT2 gets 3000, OUT3 gets 3000. If the actual count is 9500, OUT1 gets 3000, OUT2 gets 3000, OUT3 gets 3500. So the last file can be larger when the total is not divisible. If you do not know the total in advance, choose n based on a maximum expected size (e.g. 10,000 records per file) or on downstream limits.
| Option | Behavior | Typical use |
|---|---|---|
| SPLIT1R=n | First n to file1, next n to file2, …; remainder to last file | Contiguous blocks; roughly equal-sized files in order |
| SPLITBY=n | First n to file1, next n to file2, next n to file3, then next n to file1 (cycle) | Rotating blocks; balance count across files over many records |
| SPLIT (no n) | One record to file1, one to file2, one to file1, … (round-robin) | Interleave records across files |
| Multiple OUTFILs, SPLIT=n | First n to first OUTFIL, next n to second OUTFIL | First chunk to one file, next chunk to another (e.g. first 500 to OUT1, rest to OUT2) |
SPLITBY=n with FNAMES=(A,B,C) rotates blocks: first n to A, next n to B, next n to C, then next n to A again, and so on. So over a large number of records, A, B, and C each get roughly one-third of the total, but the records in each file are every third block (e.g. A has blocks 1, 4, 7, …). SPLIT1R=n fills in order: first n to A, next n to B, next n to C; remainder to C. So A has the first contiguous segment, B the second, C the third (plus remainder). Use SPLIT1R when you need contiguous ranges per file; use SPLITBY when you want rotating distribution and do not care about contiguity.
With 10 records, FNAMES=(A,B,C), and SPLIT1R=4: records 1–4 go to A, records 5–8 to B, and records 9–10 to C. So A=4, B=4, C=2. The last file gets the remainder. This is different from SPLITBY=4 with the same FNAMES, where you would get: first 4 to A, next 4 to B, next 4 to C (only 2 in this case), so A=4, B=4, C=2 for 10 records—here the result is the same because 10 is less than 12; with 12 records SPLITBY would give A=4, B=4, C=4 and then cycle; SPLIT1R would give A=4, B=4, C=4.
Each DD name in FNAMES= must have a corresponding //DDname DD ... in your JCL. The record length (and RECFM) written to each file is the same—either the full record length after INREC/OUTREC or the length defined by BUILD= on that OUTFIL. Set LRECL and SPACE on each DD to match the expected record count and record size. If the last file gets the remainder, it may have fewer (or more, if n is small) records than the others; allocate enough space for the maximum possible.
You can combine SPLIT1R=n with BUILD=, INCLUDE=, or other OUTFIL options. The record is built or filtered first; then the resulting record stream is distributed by SPLIT1R to the output files. All split files receive the same record format. Exact support and syntax (e.g. SPLIT1R vs SPLIT 1R) may vary by DFSORT product and version; always check your installation manual.
You have 10 toy cars and three boxes. SPLIT1R=4 means: put the first 4 cars in box 1, the next 4 in box 2, and the last 2 in box 3. You do not go back to box 1. So box 1 has cars 1–4, box 2 has 5–8, box 3 has 9–10. That way each box has one group of cars in order. SPLIT1R is the rule that says "fill the first box with 4, then the second with 4, then give the rest to the last box."
1. What does SPLIT1R=n do with FNAMES=(OUT1,OUT2,OUT3)?
2. How does SPLIT1R differ from SPLITBY with three output files?
3. You have 2500 records and want three output files with roughly equal contiguous blocks. What SPLIT1R value would you use?
4. When would you choose SPLIT1R over multiple OUTFILs with SPLIT=n?
5. With 10 records, FNAMES=(A,B,C), and SPLIT1R=4, how many records do A, B, and C get?