COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

These topics explain how to use these types of files to optimize disk file processing:
Unstructured Files
Structured Files
Files With Alternate Keys
Partitioned Files
Unstructured Files
A process can read and write unstructured files faster than it can read structured files, whether the
logical records of the unstructured file are blocked or not. A process can read and write blocked
unstructured files considerably faster than it can read and write unblocked unstructured files.
HP COBOL performs record blocking (for write operations) and deblocking (for read operations)
of unstructured files when all of these conditions are met:
The program describes the file’s organization as sequential.
The program does not describe the file as being composed of variable-length records (except
in the case of EDIT files, which can be described as having variable-length records).
The program includes a BLOCK CONTAINS clause that specifies an even multiple of the
established record size.
The program does not describe the file with a LINAGE clause or an ALTERNATE RECORD
KEY clause.
Structured Files
For structured files, the file system provides two independent record blocking performance
enhancements—cache buffering and sequential block buffering. In addition, HP COBOL has Fast
I-O, a faster enhancement built on top of sequential block buffering.
The type of record blocking used for a file is determined by number in the RESERVE clause of the
file-control entry.
The value of number must be in the range 1 through 32 and is interpreted:
Effect on Record BlockingValue of number
No buffering or HP COBOL Fast I-O1
Sequential block buffering on input and buffered cache on output if the assigned file
qualifies
2
HP COBOL Fast I-O if the assigned file qualifies; if not, sequential block buffering for
input and buffered cache for output if the assigned file qualifies; otherwise, normal
I-Onumber is the number of blocks to buffer
3 or greater
The BLOCK CONTAINS clause has no effect when a RESERVE clause is present—the block size
of the existing file is used.
Cache Buffering
Cache buffering is a disk-process feature that speeds up the writing of structured disk files. A cache,
or buffer pool, is an area of system memory reserved for buffering blocks of data for transfer to or
from a disk.
If cache buffering is not used, each logical write operation causes the cache block containing the
record to be written immediately to the disk. This is called write-through cache.
If cache buffering is used, the records are held in the cache (in system memory) and not immediately
written through to the disk. The blocks are written to disk only when certain situations require it.
This is called buffered cache.
Optimizing Disk File Processing 877