COBOL Manual for TNS/E Programs (H06.03+)
Disk Input and Output
HP COBOL Manual for TNS/E Programs—520347-003
28-14
Creating and Using HP COBOL Sequential Files
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
HP COBOL programs can create, read, write, and purge all of the preceding forms of
sequential file. To create an entry-sequenced file that has alternate keys, however, the
COBOL program must use the FILE_CREATE_ procedure (see Unstructured Files
).
Entry-Sequenced Files
An HP COBOL program can create and write an entry-sequenced file that any other
HP product can later read. An HP COBOL program can read an entry-sequenced file
created by any HP product.
An HP COBOL program can use the FILE_CREATE_ procedure to create an entry-
sequenced file that has alternate keys. An HP COBOL program cannot create an
entry-sequenced file that has alternate keys directly, because the operating
environment maintains the alternate keys in one or more separate files, whose names
are recorded with the operating environment information about the entry-sequenced
file (see Alternate Record Keys).










