RECORD Clause

The RECORD clause describes the size of the logical records.

General Format

RECORD { CONTAINS [min-rec TO] max-rec CHARACTERS }
       { IS VARYING IN SIZE [ FROM min-rec ]      }
       {       [ TO max-rec ] CHARACTERS          }
       {       [ DEPENDING ON depend ]            }

Syntax Rules

  1. min-rec is an integer literal that defines the smallest record size.
  2. max-rec is an integer literal that defines the largest record size.
  3. depend is a numeric data item described in Working Storage or in Linkage. ddepend cannot be in the File Section.

General Rules

  1. This clause is never required, because the minimum and maximum record sizes of a file are computed by the compiler from the file's record descriptions. However, you may want to use this clause to indicate variable-length records.
    Note: The compiler has an internal restriction of at least 6 bytes for SORT FILE records. If a record is shorter than that, the compiler detects it and pads the record to 6 bytes.
  2. No record description for a file can contain more characters than specified by max-rec or fewer characters than specified by min-rec.
  3. If min-rec is omitted, it is set to be equal to max-rec.
  4. If the VARYING phrase is used, then the file has variable-length records. If the CONTAINS phrase is used, and both min-rec and max-rec are specified, the file will contain variable-length records. If the CONTAINS phrase is used and only max-rec is specified, then the file will contain fixed-length records.
  5. If the DEPENDING ON phrase is used, the size of the record written or rewritten to the file is set according to the value of depend. When a record is read from the file, depend is set to the size of the record found. Using the DEPENDING ON phrase automatically implies that the file has variable-length records.
Note: Other source statements may take precedence over the RECORD clause in determining the record type. The complete rules for determining a file's record type are described in File Types.