Layout of format-V records

Format-V QSAM records have control fields that precede the data. The QSAM logical record length is determined by adding 4 bytes (for the control fields) to the record length defined in your program. However, you must not include these 4 bytes in the description of the record and record length.

This image depicts QSAM format-V block and record layouts.Link to detail.

CC
The first 4 bytes of each block contain control information.

LL Represents 2 bytes designating the length of the block (including the CC field).

BB Represents 2 bytes reserved for system use.

cc
The first 4 bytes of each logical record contain control information.

ll Represents 2 bytes designating the logical record length (including the cc field).

bb Represents 2 bytes reserved for system use.

The block length is determined as follows:

  • Unblocked format-V records: CC + cc + the data portion
  • Blocked format-V records: CC + the cc of each record + the data portion of each record

The operating system provides the control bytes when the file is written; the control byte fields do not appear in the description of the logical record in the DATA DIVISION of your program. COBOL allocates input and output buffers that are large enough to accommodate the control bytes. These control fields in the buffer are not available for you to use in your program. When variable-length records are written on unit record devices, control bytes are neither printed nor punched. They appear however on other external storage devices, as well as in buffer areas of storage. If you move V-mode records from an input buffer to a WORKING-STORAGE area, the records will be moved without the control bytes.

Files in the z/OS® UNIX file system are never blocked.

Related concepts  
Logical records