Compaq AAQ2G1FTK Marine Radio User Manual


 
Optimizing Your Compaq COBOL Program
15.6 I/O Operations
Specifying APPLY PREALLOCATION preallocates noncontiguous disk blocks.
When you specify the CONTIGUOUS-BEST-TRY phrase, the I/O system makes
up to three attempts to allocate as many contiguous disk blocks as it can; it then
preallocates remaining blocks noncontiguously. The CONTIGUOUS-BEST-TRY
phrase minimizes disk space fragmentation and gives better system throughput
than CONTIGUOUS.
The APPLY CONTIGUOUS (physically adjacent) clause makes one attempt
at contiguous preallocation; if it fails, the OPEN operation fails. Use APPLY
CONTIGUOUS if you require contiguous physical space on disk.
Contiguous files can reduce or eliminate window turning. When you access a
file, the file system maps virtual block numbers to logical block numbers. This
map is a window to the file. It contains one pointer for each file extent. The file
system cannot map a large noncontiguous file: the file system may have to turn
the window to access records in another extent. However, a contiguous file is one
extent. It needs one map pointer only, and window turning does not take place
after you open the file.
The following statements create a file (after OPEN/WRITE) and preallocate 150
contiguous blocks:
ENVIRONMENT DIVISION.
FILE-CONTROL.
SELECT A-FILE ASSIGN TO "MYFILE".
.
.
.
I-0-CONTROL.
APPLY CONTIGUOUS PREALLOCATION 150 ON A-FILE.
.
.
.
15.6.1.2 Using the EXTENSION Phrase of the APPLY Clause
The format of APPLY EXTENSION is as follows:
APPLY EXTENSION extend-amt ON { file-name } ...
The APPLY EXTENSION clause is another way to reduce I/O allocation and
extension time. Adding records to a file whose current extent is full causes
the file system to extend the file by one disk cluster. (A disk cluster is a set of
contiguous blocks; its size is determined when you initialize the volume with
the DCL INITIALIZE command or when the volume is mounted with the DCL
MOUNT qualifier: /EXTENSION=n.)
You can override the default extension by specifying the number of blocks in the
APPLY EXTENSION clause. The APPLY EXTENSION integer becomes a file
attribute stored with the file.
15.6.1.3 Using the DEFERRED-WRITE Phrase of the APPLY Clause
The format of APPLY DEFERRED-WRITE is as follows:
APPLY DEFERRED-WRITE ON { file-name } ...
Optimizing Your Compaq COBOL Program 1511