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

Disk Input and Output
HP COBOL Manual for TNS/E Programs520347-003
28-33
Structured Files
Each disk has its own cache. Each cache is configured to have space for a certain
quantity of disk data. Each disk device has an associated disk process that performs
the physical operations of reading data from the disk into cache memory and writing
data from cache memory to the disk.
When a process requests a record from a given disk, the Enscribe record manager
checks that particular cache for the block that contains the record. If that block is not
present in the cache, Enscribe must perform a physical read from the disk and then
return the record to the application process. If the block is present, Enscribe does not
need to do the read operation; it can simply return the record to the application
process.
Sequential Block Buffering
Sequential block buffering (SBB) is an Enscribe feature that speeds the sequential
reading of a structured file by reading a block of records together into a memory buffer.
Enscribe allocates the buffer in the process file segment outside the data space of your
process.
If the file has no alternate keys, the size of the buffer is the block size of the file. If the
file has alternate keys, the alternate-key file (not the primary file) is buffered, because
the alternate-key file is being read sequentially, while the primary file is probably being
read randomly.
Without sequential block buffering, every time an application program performs a read
operation, the HP COBOL run-time routines must call the READ routine, which causes
the file system to send a message to the disk process and causes the disk process to
return a message containing the record. With sequential block buffering, only entire
blocks are sent, and any records in the block after the first one are delivered from the
process file segment without any message traffic.
HP COBOL provides sequential block buffering for a file when all of these conditions
are met:
The file is structured.
The file’s open mode is INPUT or I-O.
The program declares the file to have sequential access mode (although
organization can be sequential, relative, or indexed).
Note. With the advent of the DP2 disk processing system, normal” I/O could be faster than
sequential block buffering, depending on the number of records per block. For example, a file
containing eight 4K blocks and 1600 records requires one physical I/O operation and 1600
interprocess messages in normal mode, but eight physical I/O operations and only eight
interprocess messages in SBB mode; on the other hand, a file with eight 4K blocks and only
eight records requires one physical I/O and eight interprocess messages in normal mode, but
eight physical I/O operations and eight interprocess messages in SBB mode
Caution. Do not use sequential block buffering for a file opened for shared access. If you do,
a process could read data that is not up to date while another process alters the file.