BLOCK CONTAINS Clause

The BLOCK CONTAINS clause specifies the size of a physical record.

General Format

BLOCK CONTAINS [min-block TO] max-block {RECORDS   } 
                                        {CHARACTERS}

Syntax Rules

  1. min-block is an integer literal which specifies the minimum block size.
  2. max-block is an integer literal which specifies the maximum block size.

General Rules

  1. The BLOCK CONTAINS clause specifies the physical record size.
  2. 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.
  3. The compiler ignores the BLOCK CONTAINS clause for relative files.
  4. 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.
  5. For sequential files, all input and output is done by blocks.
  6. 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.
  7. The CHARACTERS phrase specifies the physical record size in terms of characters.
  8. The final block of a file may contain fewer characters than specified by the BLOCK CONTAINS clause.
  9. 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).
  10. 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.