RECORD CONTAINS is an optional clause in the FD (File Description) in the FILE SECTION. It specifies the length of a logical record in characters. Use it for fixed-length records (e.g. RECORD CONTAINS 80 CHARACTERS) or a range for variable-length records (RECORD CONTAINS min TO max CHARACTERS). The actual record layout is still defined by the 01-level entries under the FD; see Variable records for variable-length handling.
RECORD CONTAINS appears in the FD for a file, in the DATA DIVISION FILE SECTION. It can appear with other FD clauses such as BLOCK CONTAINS and RECORDING MODE. CHARACTERS is often optional (e.g. RECORD CONTAINS 80 means 80 characters).
123456789FILE SECTION. FD CARD-FILE RECORD CONTAINS 80 CHARACTERS BLOCK CONTAINS 0 RECORDS. 01 CARD-RECORD PIC X(80). FD REPORT-FILE RECORD CONTAINS 132 CHARACTERS. 01 REPORT-LINE PIC X(132).
| Clause | Meaning |
|---|---|
| RECORD CONTAINS 80 CHARACTERS | Each logical record is 80 bytes (e.g. card image) |
| RECORD CONTAINS 100 TO 500 CHARACTERS | Variable-length records; min 100, max 500 |
| RECORD CONTAINS 120 | Same as 120 CHARACTERS; record length 120 |
RECORD CONTAINS is the size of one logical record (one line, one card image, one transaction). BLOCK CONTAINS is the size of a physical block (how many bytes or how many records are written together). For unblocked files, block size often equals record size; for blocked files, one block holds multiple records.
RECORD CONTAINS says how long one “row” of data is (e.g. 80 boxes for a punch card). BLOCK CONTAINS says how many rows are packed into one chunk on disk. RECORD CONTAINS is “one row”; BLOCK CONTAINS is “how many rows in a block.”
1. In which section does RECORD CONTAINS appear?
2. What does RECORD CONTAINS specify?