COBOL Manual for TNS and TNS/R Programs
Environment Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
6-45
FILE-CONTROL Paragraph
Usage Considerations:
•
Relative Key
Every record in a relative file is uniquely identified by a positive integer called the
relative record number. Each record’s number defines its logical position in the file.
The first logical record has a relative number of 1, the second logical record has a
relative number of 2, and so on. A file is not required to contain records in every
logical position; record 3 can exist even when record 2 is missing.
•
Alternate Record Keys
The records within the file can be accessed in ascending order of the alt-key
value. The order in which records are obtained using alt-key can differ from the
order obtained using rel-key. You can define up to 31 alternate keys for a file.
If you include the DUPLICATES phrase in the ALTERNATE RECORD KEY clause,
the value of alt-key need not be unique for each record in the file. Depending
on the INSERTIONORDER parameter of the alternate key file, records with
duplicate alternate key values are inserted (or retrieved) in either prime key order
or in the order in which they were inserted in the file.
The data description entry for alt-key cannot contain an OCCURS clause or be
subordinate to an entry that contains an OCCURS clause. The leftmost character
position of an alt-key item cannot correspond to the leftmost character position
of another alt-key item in that file.
The file-control entry can contain at most one ALTERNATE RECORD KEY clause
that describes a particular alternate record key of the file.
If a file in the file system is defined as having alternate record keys to which the
COBOL program does not make any reference, you do not need to specify them in
the File-Control paragraph.
•
Sequential Block Buffering
Sequential block buffering, enabled by the RESERVE clause when the file is open
in INPUT or I-O mode, is discussed under File-Control Entries for Sequential Files.
•
Buffered Cache
Buffered cache, enabled by the RESERVE clause when the file is open in
OUTPUT, I-O, or EXTEND mode, is discussed under File-Control Entries for
Sequential Files.
Note. COBOL record numbers begin at 1. This is different from the Guardian file-system
convention of beginning record numbers at 0. The COBOL run-time I-O routines deduct 1
from the COBOL relative record number to obtain the Guardian file-system record number.
When a COBOL program requests record 1, it receives the first record in the file—the
record that the Guardian file system designates 0. Remember this difference if other HP
products are to operate on a file.