RECORDING MODE clause

The RECORDING MODE clause specifies the format of the physical records in a QSAM file. The clause is ignored for a VSAM file.

Permitted values for RECORDING MODE are:

Recording mode F (fixed)
All the records in a file are the same length and each is wholly contained within one block. Blocks can contain more than one record, and there is usually a fixed number of records for each block. In this mode, there are no record-length or block-descriptor fields.
Recording mode V (variable)
The records can be either fixed-length or variable-length, and each must be wholly contained within one block. Blocks can contain more than one record. Each data record includes a record-length field and each block includes a block-descriptor field. These fields are not described in the DATA DIVISION. They are each 4 bytes long and provision is automatically made for them. These fields are not available to you.
Recording mode U (fixed or variable)
The records can be either fixed-length or variable-length. However, there is only one record for each block. There are no record-length or block-descriptor fields.

You cannot use RECORDING MODE U if you are using the BLOCK CONTAINS clause.

Recording mode S (spanned)
The records can be either fixed-length or variable-length, and can be larger than a block. If a record is larger than the remaining space in a block, a segment of the record is written to fill the block. The remainder of the record is stored in the next block (or blocks, if required). Only complete records are made available to you. Each segment of a record in a block, even if it is the entire record, includes a segment-descriptor field, and each block includes a block-descriptor field. These fields are not described in the DATA DIVISION; provision is automatically made for them. These fields are not available to you.

When recording mode S is used, the BLOCK CONTAINS CHARACTERS clause must be used. Recording mode S is not allowed for ASCII files.

If the RECORDING MODE clause is not specified for a QSAM file, the Enterprise COBOL compiler determines the recording mode as follows:

F
The compiler determines the recording mode to be F if the largest level-01 record associated with the file is not greater than the block size specified in the BLOCK CONTAINS clause, and you do one of the following things:
  • Use the RECORD CONTAINS integer clause. (For more information, see the Enterprise COBOL Migration Guide.)
  • Omit the RECORD clause and make sure that all level-01 records associated with the file are the same size and none contains an OCCURS DEPENDING ON clause.
V
The compiler determines the recording mode to be V if the largest level-01 record associated with the file is not greater than the block size specified in the BLOCK CONTAINS clause, and you do one of the following things:
  • Use the RECORD IS VARYING clause.
  • Omit the RECORD clause and make sure that all level-01 records associated with the file are not the same size or some contain an OCCURS DEPENDING ON clause.
  • Use the RECORD CONTAINS integer-1 TO integer-2 clause, with integer-1 the minimum length and integer-2 the maximum length of the level-01 records associated with the file. The two integers must be different, with values matching minimum and maximum length of either different length records or records with an OCCURS DEPENDING ON clause.
S
The compiler determines the recording mode to be S if the maximum block size is smaller than the largest record size.
U
Recording mode U is never obtained by default. The RECORDING MODE U clause must be explicitly specified to get recording mode U.