ContentsIndexPreviousNext

5.4.4 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, the computed block size must be either 512 or 1024 bytes. If the block size is not one of these two values, Vision uses 1024 bytes for a block size greater than 1023, and uses 512 bytes otherwise.

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).

11. The ACUCOBOL-GT User's Guide (section 6.1) has more details on the handling of file blocking.