COBOL Manual for TNS and TNS/R Programs
Environment Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
6-34
FILE-CONTROL Paragraph
•
Alternate Record Keys
Records in a file can be read in the ascending order of alternate key values, even if
the file’s organization is sequential or relative. The order in which records are
obtained using alt-key can differ from the order in which the records are stored.
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
(the way NonStop systems software ordinarily works) or in the order in which they
were inserted in the file (as specified in the 1985 ISO/ANSI COBOL standard).
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.
An alt-key is permitted only for structured disk files and not for unstructured
disk files or files that are not disk files. A file having a LINAGE clause in its file
description cannot be a disk file (although it can be spooled to a printer by way of a
disk). It is, therefore, never legal to define a file with an ALTERNATE RECORD
KEY clause and have a LINAGE clause in the file description entry for that file.
•
Sequential Block Buffering
Sequential block buffering, enabled by the RESERVE clause when the file is open
in INPUT or I-O mode, is a feature of the Enscribe database record manager that
enables faster reading of a sequentially structured file by reading a block of
records together into a memory buffer. The file’s access must be sequential, but its
organization can be sequential, relative, or indexed.
A program requests sequential block buffering (or does not request it) when it
opens the file. Each process that opens the file requests or does not request
sequential block buffering. One process can request it while another process does
not. Nothing stored on the disk keeps a record of whether the file is to be read with
sequential block buffering.
The RESERVE clause acts as a switch. In the CRE, the number 2 means to use
sequential block buffering on input (and buffered cache on output) if the assigned
file qualifies.