COBOL Manual for TNS/E Programs (H06.03+)
Disk Input and Output
HP COBOL Manual for TNS/E Programs—520347-003
28-11
Structured Files
In HP COBOL, the DEPENDING phrase of the RECORD IS VARYING 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.
HP COBOL allows writing and reading zero-length records. To write a zero-length
record, specify
RECORD IS VARYING FROM 0 TO ... DEPENDING ON data-name
and move the value zero into data-name before writing. After you read a file with the
same record description, data-name has the value zero. TMF writes zero-length
records when it backs out of transactions.
If an HP COBOL program describes fixed-length records, any zero-length records are
discarded when read. If an HP COBOL program describes variable-length records,
upon return from the READ statement, the entire record area is undefined. For this
reason, you are advised to specify 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.
Space occupied
by a record ...
Depends on length
specified when
record is written
Maximum logical
record length = 4,072
bytes
Is specified when file
is created
Maximum logical
record length = 4,072
bytes
Depends on length
specified when record
is written
Maximum logical record
length = 2,035 bytes
Record can be
shortened or
lengthened
No Yes Yes, and space freed
by shortening a record
can be reused within its
block
Record can be
deleted
No, but its space can
be used for another
record of the same
size
Yes, and its space can
be reused
Yes, and its space can
be reused within its
block
Table 28-4. Comparison of Structured File Characteristics (page 2 of 2)
Characteristic
Type of Structured File
Entry-Sequenced
(Sequential) Relative
Key-Sequenced
(Indexed)










