MainframeMaster

RECORD Statement

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.

Control Statements
Progress0 of 0 lessons

What RECORD Does

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.

RECORD TYPE=

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.

RECORD LENGTH=

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.

When RECORD Is Needed

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.

Explain It Like I'm Five

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.

Exercises

  1. When would you code RECORD TYPE=F,LENGTH=80 in SYSIN?
  2. What is the difference between RECORD and the DCB on the DD statement?

Quiz

Test Your Knowledge

1. What is the RECORD statement used for in DFSORT?

  • To sort by record
  • To specify record type (e.g. F for fixed, V for variable) and/or length when DFSORT cannot infer them from the DD or data
  • To merge records
  • To define the sort key

2. When might you need RECORD TYPE=F or TYPE=V?

  • Always
  • When the input or output dataset does not have a proper DCB (e.g. tape, or dynamic allocation without LRECL) so DFSORT needs to be told the format
  • Only for MERGE
  • Only for OUTFIL

3. RECORD LENGTH=80 typically means what?

  • Sort key length
  • The logical record length is 80 bytes (for fixed-length records)
  • Number of records
  • Block size