Compaq AAQ2G1FTK Marine Radio User Manual


 
Optimizing Your Compaq COBOL Program
15.7 Optimizing File Design (OpenVMS)
FILE SECTION.
FD FILE-A
BLOCK CONTAINS 5 RECORDS.
01 FILE-A-REC PIC X(64).
.
.
.
By contrast, for magnetic tape, the program code entirely controls blocking.
Hence, efficiency of the program and the file depends on the programmer’s care
with magnetic-tape blocking.
15.7.2 Relative Files
I/O optimization of a relative file depends on four concepts:
Maximum record number—The highest numbered record written to a relative
file.
Cell size—The unit of disk space needed to store a record unit size (record
unit size = record + record overhead).
Bucket size—The number of blocks read or written in one I/O operation
(equivalent to buffer size). A bucket contains from 1 to 63 physical blocks.
File size—The number of blocks used to preallocate the file.
15.7.2.1 Maximum Record Number (MRN)
If you create a relative file with a Compaq COBOL program, the system sets the
maximum record number (MRN) to 0, allowing the file to expand to any size.
If you create a relative file with the CREATE/FDL Utility, select a realistic MRN,
since an attempt to insert a record with a number higher than the MRN will
fail.
15.7.2.2 Cell Size
The system calculates cell size. (However, you can specify a different cell size
when you create the file by using the RECORD CONTAINS clause in the file
description.) You cannot write records larger than the specified cell size.
Avoid selecting a cell size larger than necessary since this wastes disk space. To
optimize the packing of cells into buckets, cell size should be evenly divisible into
bucket size.
The system calculates cell size using these formulas:
Fixed-length records: cell size = 1 + record size
Variable-length records: cell size = 3 + record size
For fixed-length records, the overhead byte is a record deletion indicator.
Variable-length records use two additional overhead bytes to indicate record
length. The following example calculates a cell size of 101 for fixed-length records:
FD A-FILE
RECORD CONTAINS 100 CHARACTERS
.
.
.
1516 Optimizing Your Compaq COBOL Program