COBOL Manual for TNS and TNS/R Programs
Disk Input and Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
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.
Table 28-4. Comparison of Structured File Characteristics
Characteristic
Type of Structured File
Entry-Sequenced
(Sequential) Relative
Key-Sequenced
(Indexed)
Records
ordered by ...
Order in which they
were entered
Record number Value of prime record
key
Access is by ... Record address or
alternate record key
Maximum alternate
record key length =
253 bytes (249 if not
unique)
Record number or
alternate record key
Maximum record
number = 1,048,575
Maximum alternate-
key length = 253 bytes
(249 if not unique).
Prime or alternate
record key
Maximum prime record
key length = 522 bytes
Maximum alternate
record key length = 253
bytes (253 minus prime
length if not unique)
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