Optimizing YourCompaq 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 APPLYClause
The format of APPLYFILL-SIZE is as follows:
APPLYFILL-SIZE ON { file-name} ...
Use the APPLYFILL-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 APPLYFILL-SIZE clause forroutine record insertion; it prohibits
the use of bucket fill space and creates unnecessary buckets.
15.6.1.5 Using the WINDOW Phrase of the APPLYClause
The format of APPLYWINDOW is as follows:
APPLYWINDOW 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 APPLYWINDOW
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.
Youcan 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_DEFAULTcommand.) The following example reserves six areas
for FILE-A:
SELECT FILE-A ASSIGN TO "FILE-A"
RESERVE 6 AREAS.
Youcan specify up to 127 areas in the RESERVE clause. In general, specifying
from 2 to 10 areas is best.
1512 Optimizing YourCompaq COBOL Program