The BLOCK CONTAINS clause specifies the size of a physical record.
General Format
BLOCK CONTAINS [min-block TO] max-block {RECORDS }
{CHARACTERS}
Syntax Rules
- min-block is an integer literal which specifies the minimum block size.
- max-block is an integer literal which specifies the maximum block size.
General Rules
- The BLOCK CONTAINS clause specifies the physical record size.
- The
min-block specification is treated as commentary by the compiler. However, if RM/COBOL compatibility mode is being used, and
min-block is specified, then the entire BLOCK CONTAINS clause is ignored by the compiler.
- The compiler ignores the BLOCK CONTAINS clause for relative files.
- For Vision files,
max-block should be a multiple of 512 up to 8192 (the value is the block size in bytes). For Version 3 and 2 files,
max-block should not exceed 1024. If it does, Vision automatically reduces it to 1024.
- For sequential files, all input and output is done by blocks.
- The RECORDS phrase specifies the physical record size in terms of logical records. If the file contains variable-length records,
then the exact block size will vary from machine to machine depending on how variable-length records are stored on the host
machine. The record size used to compute the block size is equal to the largest logical record.
- The CHARACTERS phrase specifies the physical record size in terms of characters.
- The final block of a file may contain fewer characters than specified by the BLOCK CONTAINS clause.
- If no BLOCK CONTAINS clause is specified, the block size is set to one record. For files with variable-length records, the
block size is set to the current record size (not necessarily the largest).
- Records read from a file with variable-length records are internally blocked by ACUCOBOL-GT if no BLOCK CONTAINS clause is
specified. This allows for efficient processing of these files on input while still allowing for line-by-line control over
an output device (such as a printer).
See Handling Files for details on the handling of file blocking.