COBOL Manual for TNS/E Programs (H06.03+)
Disk Input and Output
HP COBOL Manual for TNS/E Programs—520347-003
28-36
Partitioned Files
Making the Main File Entry-Sequenced or Relative
If your main file has several keys defined but no one key is used substantially more
than any other keys, consider making that main file a relative or entry-sequenced file
rather than a key-sequenced file.
Every time you read a key-sequenced file by prime key, you cause two possible
physical read operations: one for the key and one for the record. Every time you read a
key-sequenced file by alternate key, you cause four possible physical read operations:
one for the alternate key, one for the alternate-key record, one for the prime key, and
one for the record. If the main file has two keys and the probability of reading the file by
any given key is about even, then half the time you could cause two physical read
operations and half the time you could cause four. For each logical read operation, you
average three physical read operations.
If the main file has two keys and the probability of reading the file by any given key is
about even, you also average three physical read operations for each logical read
operation if you choose entry-sequenced or relative organization for the main file;
however, if the main file has more than two keys, the average number of physical read
operations per logical read operation improves.
The average number of physical read operations per logical read operation improves
even further when several records in the alternate-key file or main file are in the same
physical block and no physical read is required, such as when you are reading
sequentially on an alternate key.
Not Updating the Alternate-Key File Automatically
Another way to improve the performance of alternate-key file access is to specify that
the alternate-key file not be automatically updated by the operating environment when
the value of an alternate-key field changes (use the FUP parameter NOUPDATE). This
is appropriate when your only means of updating the file is a batch update program
that runs when no interactive processes are reading the file; you can run the batch
update, then re-create the alternate-key file and reload it. Do not use the NOUPDATE
parameter if the file is updated interactively, because the changed records do not
cause any changes in the alternate-key file until the next batch update.
Partitioned Files
Partitioned files can be accessed faster because separate read heads are used for
each partition. Loss of access to one disk need not mean loss of access to the entire
file.
You can divide an indexed file according to the value of the prime key and have, for
example, A through C on the first disk volume and U through Z on the last disk
volume. If one of the disks is taken offline for maintenance, or if one system of the
network is inaccessible due to communication problems, the remainder of the
partitioned file is still accessible.










