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

Disk Input and Output
HP COBOL Manual for TNS/E Programs520347-003
28-32
Structured Files
The value of number must be in the range 1 through 32 and is interpreted:
The BLOCK CONTAINS clause has no effect when a RESERVE clause is present—
the block size of the existing file is used.
Topics:
Cache Buffering
Sequential Block Buffering
HP COBOL Fast I-O
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.
By default, files that are audited by TMF use cache buffering, and files that are not
audited do not.
When a file is opened, the call to the FILE_OPEN_ procedure includes a parameter
that determines whether or not cache buffering is used—that is, whether the file has
the attribute BUFFERED. You can give a file the BUFFERED attribute by using FUP
routines or the corresponding Enscribe routines through environment procedure calls;
then all output to the file is done with cache buffering.
Value of number Effect on Record Blocking
1 No buffering or HP COBOL Fast I-O
2 Sequential block buffering on input and buffered cache on output if
the assigned file qualifies
3 or greater 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-O
number is the number of blocks to buffer
Caution. Do not use cache buffering with a program that requires that each record actually be
written on the disk before the next statement in the program is executed. If your program is
writing to a file that is opened with the exclusion mode SHARED or PROTECTED, give careful
consideration to the use of cache buffering, because other processes can read the file and
could read a record that your writing process has updated but which the file system has not yet
delivered to the disk.