7 optimizing file design (openvms) – Compaq COBOL AAQ2G1FTK User Manual

Page 505

Advertising
background image

Optimizing Your Compaq COBOL Program

15.6 I/O Operations

15.6.4 Using COMP Unsigned Longword Integers

The compiler generates the most efficient code to process the following clauses
if a COMP unsigned longword integer (that is, PIC 9(9) COMP) is used in those
cases where a variable is needed:

RELATIVE KEY
DEPENDING ON
LINAGE IS
WITH FOOTING AT
LINES AT TOP
LINES AT BOTTOM
ADVANCING LINES

15.7 Optimizing File Design (OpenVMS)

This section provides information on how to optimize the following file types:

Sequential

Relative

Indexed

For a full discussion of file types, see Chapter 6.

15.7.1 Sequential Files

Sequential files have the simplest structure and the fewest options for definition,
population, and handling. You can reduce the number of disk accesses by
minimizing record length.

With a sequential disk file, you can use multiblocking to access a buffer area
larger than the default. Because the system transfers disk data in 512-byte
blocks, a blocking factor with a multiple of 512 bytes improves I/O access time.
In the following example, the multiblock count (four) causes reads and writes to
FILE-A to access a buffer area of four physical blocks:

FILE SECTION.
FD

FILE-A
BLOCK CONTAINS 2048 CHARACTERS

.
.
.

If you do not want to calculate the buffer size, but want to specify the number
of records in each buffer, use the BLOCK CONTAINS n RECORDS clause. The
following example specifies a buffer large enough to hold 15 records:

BLOCK CONTAINS 15 RECORDS

When using the BLOCK CONTAINS n RECORDS clause for sequential files on
disk, RMS calculates the buffer size by using the maximum record unit size and
rounding up to a multiple of 512 bytes. Consequently, the buffer could hold more
records than you specify.

In the following example, the BLOCK CONTAINS clause specifies five records.
RMS calculates the block size as eight records, or 512 bytes.

Optimizing Your Compaq COBOL Program 15–15

Advertising