Compaq COBOL AAQ2G1FTK User Manual

Page 502

Advertising
background image

Optimizing Your Compaq COBOL Program
15.6 I/O Operations

Each WRITE or REWRITE statement can cause an I/O operation. The APPLY
DEFERRED-WRITE clause permits writes to a file only when the buffer is full.
Reducing the number of WRITE operations reduces file access time. However,
the APPLY DEFERRED-WRITE clause can affect file integrity: records in the
I/O buffer are not written to the file if the system crashes or the program aborts.
DEFERRED-WRITE is very useful on write-shared files.

15.6.1.4 Using the FILL-SIZE ON Phrase of the APPLY Clause

The format of APPLY FILL-SIZE is as follows:

APPLY FILL-SIZE ON { file-name } ...

Use the APPLY FILL-SIZE clause to populate (load) the file and force the Compaq
COBOL compiler to write records into the bucket area not reserved by the fill
number. Routine record insertion uses the fill space, thereby reducing bucket
splitting and the resulting overhead.

Do not use the APPLY FILL-SIZE clause for routine record insertion; it prohibits
the use of bucket fill space and creates unnecessary buckets.

15.6.1.5 Using the WINDOW Phrase of the APPLY Clause

The format of APPLY WINDOW is as follows:

APPLY WINDOW ON { file-name } ...

Window size is the number of file mapping pointers stored in memory. A large
window improves I/O because the system spends less time remapping the file.

When a disk is initialized, the default window size is set by specifying the
/WINDOW qualifier. You can override this qualifier with the APPLY WINDOW
clause. However, avoid specifying too large a window size. Window size is
part of the system’s pool space, and a large window size could affect system
performance.

15.6.2 Using Multiple Buffers

Multibuffering can increase the speed of I/O operations by reducing the number
of file accesses. When a program accesses a record already in the I/O buffer, the
system moves the record to the current record area without executing an I/O
operation.

You can specify multiple buffering by using the RESERVE clause in the SELECT
statement of the Environment Division. The RESERVE clause specification
overrides the system default. (The system default is usually set by means of the
DCL SET RMS_DEFAULT command.) The following example reserves six areas
for FILE-A:

SELECT FILE-A ASSIGN TO "FILE-A"

RESERVE 6 AREAS.

You can specify up to 127 areas in the RESERVE clause. In general, specifying
from 2 to 10 areas is best.

15–12 Optimizing Your Compaq COBOL Program

Advertising