COBOL Manual for TNS/E Programs (H06.03+)
Disk Input and Output
HP COBOL Manual for TNS/E Programs—520347-003
28-35
Files With Alternate Keys
For a file opened for input, HP COBOL Fast I-O allocates space for double buffering
from a buffer pool that is in its own extended data segment and is of a fixed size. Buffer
size is determined by multiplying the number in the RESERVE clause by the data block
size of the file (to see this size, use the command FUP INFO file-name, DETAIL).
Then, based on various factors such as the maximum transfer allowed, a read buffer
size that is not larger than 30,720 bytes is selected. The total space allocated from the
buffer pool is twice the read buffer size. If there is not enough space (as when several
files are opened for input using HP COBOL Fast I-O at the same time), the OPEN
statement returns file status “07” and sequential block buffering is used for the file.
The buffer pool space returns to the pool when the file is closed. The SAME AREA
clause has no effect on allocation or deallocation from this buffer pool.
If the file is being created and the maximum file size is exceeded, the corrupt bit is set
in the file header and the program terminates abnormally. Attempting to open the file
causes a file system error. If the file is sequential, you can use FUP to clear the corrupt
bit and read what was written to the file (all of the records you released with WRITE will
probably not be there). If the file is relative or indexed, the file is unusable.
Files With Alternate Keys
You can improve the performance of alternate-key file access by:
•
Declaring Null Values for Alternate Keys
•
Making the Main File Entry-Sequenced or Relative
•
Not Updating the Alternate-Key File Automatically
Declaring Null Values for Alternate Keys
When you create an alternate-key file with FUP CREATE, you can declare a null value
for any alternate key. When you insert a record, if each byte in the alternate-key field
contains that null value, the alternate-key reference is not added to the alternate-key
file. This reduces both the size of the alternate-key file and the access time for the
records of a file being accessed according to that alternate key. It also makes the
records that have null values invisible when you read the file by an alternate key for
which a null value has been defined.
If you update a record in the file in such a way that the alternate-key field receives a
null value, the alternate-key reference for that record is deleted from the alternate-key
file.
If you read a file according to an alternate key for which a null value has been defined,
records containing the null value of the alternate key are not read.
The most common null values are the ASCII space and the binary zero.










