The RECORD control statement lets you tell DFSORT the record type (fixed or variable) and/or the record length when that information is not provided by the dataset's DCB. For example, with tape datasets or certain dynamic allocations, the DCB might be missing or incomplete. You use RECORD TYPE=F (fixed) or TYPE=V (variable) and optionally RECORD LENGTH=n so DFSORT knows how to read or write the data. In many batch jobs, the DD statement and catalog provide RECFM and LRECL, so RECORD is not needed. This page covers when to use RECORD and the TYPE= and LENGTH= parameters.
RECORD supplies or overrides record-format information that DFSORT would otherwise get from the dataset (RECFM, LRECL). When you allocate a dataset with a full DCB (e.g. DCB=(RECFM=FB,LRECL=80)), DFSORT uses that. When the DCB is missing or you need to override (e.g. for SORTIN or SORTOUT), you can code RECORD TYPE= and LENGTH= in SYSIN so the sort knows how to interpret the data.
TYPE=F (or similar) indicates fixed-length records. TYPE=V indicates variable-length records (typically with a 4-byte RDW prefix). The exact keywords may vary by DFSORT version; see your documentation.
LENGTH=n specifies the logical record length in bytes. For fixed format, n is the length of each record. For variable format, n may be the maximum record length. This is used when the DD or dataset does not provide LRECL.
Use RECORD when: (1) the dataset is on tape or has no catalog DCB, (2) the step uses dynamic allocation and LRECL/RECFM are not set, or (3) you need to override the dataset's DCB for the sort step. For normal disk datasets with a proper DCB, RECORD is usually omitted.
RECORD is like telling the sorter: "Each card in this box is 80 spaces long" (TYPE=F, LENGTH=80) or "The cards can be different lengths, and each has a little label at the start saying how long it is" (TYPE=V). So the sorter knows how to read the box when the box doesn't have a label.
1. What is the RECORD statement used for in DFSORT?
2. When might you need RECORD TYPE=F or TYPE=V?
3. RECORD LENGTH=80 typically means what?