COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
the DEPENDING phrase when reading variable-length records, and to process zero-length records
appropriately (by ignoring them, for example).
Under Enscribe, entry-sequenced files can have alternate keys. You must create these files by calling
Enscribe directly in one of these ways:
• From your TACL session, use FUP.
• From within an HP COBOL program, call the FILE_CREATE_ procedure.
Entry-Sequenced (Sequential) Files
An entry-sequenced file created by an HP COBOL program is either a series of fixed-length records
or a series of variable-length records.
Your program ordinarily reads entry-sequenced files sequentially. You can read the records in the
order in which they appear in the file by opening the file for input and reading record after record.
You can append records to the file by opening the file with an extension and writing records to
the file.
Enscribe allows each physical record of an entry-sequenced file to have any length from zero bytes
(empty) to the maximum record length that was declared when the file was created. HP COBOL
allows each logical record to have any length from zero bytes to the maximum record length
declared explicitly in the file description entry or implicitly in the record definitions following the
file description entry.
If your source program describes the file as having variable-length records, each physical record
uses only as many bytes of disk space as needed; therefore, the number of records for each block
can vary according to the length of the records in each block (although some space at the end of
a block can be wasted).
If an entry-sequenced file has alternate keys, you can use a START statement to specify the next
record to read.
Relative Files
Relative files contain records that exist independent of each other. Each record is associated with
a unique relative record number—an ordinal number. The first record is number 1, the second is
number 2, and so forth. The number exists independent of the contents of the record. You can read
any record by number, but the record number is not part of the record.
The record numbers of a relative file need not be consecutive; Enscribe does not require that there
be a record for each ordinal number between that of the first record and the highest number
associated with any record in the file. If the HP COBOL run-time routines ask Enscribe for the record
associated with a certain number 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, the run-time routine stores an appropriate value in it).
You can also read the file in record-number order. In this case, Enscribe does not report absent
records—it returns the records that exist. Enscribe can report the record number of each record as
it is read. When you read a relative file this way, the HP COBOL run-time routines set the relative
key data item to reflect the record number.
Both Enscribe and HP COBOL (as an HP extension) provide two special record numbers: -1 and
-2. If you specify record number -1, a record is written at the end of the file; if you specify record
number -2, a record is written in the next available position.
Enscribe allocates the same fixed amount of disk storage to each record. Each record can vary in
length from empty to that fixed limit. In HP COBOL terms, you can write fixed-length records of
Types of HP Disk Files 863










