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

any length up to the limit, or variable-length records of any length up to the limit. If HP COBOL
creates the file for you, that limit is the larger of:
The length of the longest record description entry for the file
The maximum record length explicitly stated in the RECORD clause of the file description entry
for the file
If a relative file has alternate keys, you can use a START statement not only to specify the next
record to read, but also to change the key of reference.
You can write anywhere in the file, replacing existing records or installing a record at an ordinal
position that had no record associated with it. You can replace an existing record with a record
of a different length. You can delete a record. A deleted record is not the same as a record of
length zero. A read operation with an invalid key leaves the contents of the record area undefined
(that is, unpredictable).
Key-Sequenced (Indexed or Queue) Files
Key-sequenced files contain records that are stored in independent positions on the disk, but
accessed in ascending sequence ordered by the unique value of a field within each record. Enscribe
calls this field the prime record key; HP COBOL calls it the prime record key. You can read any
record by specifying its key value.
A key-sequenced file can be incomplete; Enscribe does not require that there be a record for each
possible key value. If HP COBOL run-time routines ask Enscribe for the record associated with a
certain key value, and there is no such record in the file, Enscribe reports that no such record exists
and the HP COBOL run-time routine raises the invalid-key condition (and, if you defined a file status
code data item, stores an appropriate value in it).
You can also read the file in key-value order. In this case, Enscribe does not report absent records—it
returns the records that exist. Because the key is part of the record, you have access to the key
value when you have read the record.
Enscribe allocates only as much space on disk as necessary for each key-sequenced file record.
Each record can vary in length from empty to the maximum record length defined for the file. In
HP COBOL terms, you can write fixed-length or variable-length records (whichever the file was
declared to have) of any length up to the limit. If HP COBOL creates the file for you, that limit is
the larger of:
The length of the longest record description entry for the file
The length declared in the RECORD CONTAINS clause
You can write records anywhere in the file, introducing new records or replacing existing records.
You can replace an existing record with a record of a different length. You can delete a record.
A deleted record is not the same as a record of length zero.
In HP COBOL, the DEPENDING phrase of the RECORD CONTAINS clause enables you to designate
a data item to receive the record length upon the successful completion of a READ statement and
to control the record length for a WRITE statement. A read operation with an invalid key leaves
the contents of the record area undefined (that is, unpredictable).
Creating and Using HP COBOL Sequential Files
In a sequential file—a file with sequential organization—records are arranged in a fixed
predecessor-successor relationship that is established as the records are entered in the file.
HP COBOL sequential files fall into these categories:
Entry-Sequenced Files
Unstructured Files
Unstructured EDIT Files
864 Disk Input and Output