COBOL Manual for TNS and TNS/R Programs
Data Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
7-21
File Description Entries
•
Depending Item
When length-var is specified, the data item it references is called the
depending item.
°
Governs the length of the record to be written
The contents of this item, evaluated just before the execution of a REWRITE or
WRITE statement for the file, determine the size of the record to be written.
°
Contains the length of the record after it has been read
After the successful execution of a READ statement for the file, the contents of
the depending item indicate the size of the item just read.
The size is expressed in characters.
The execution of a DELETE, RELEASE, REWRITE, START, or WRITE statement,
or the unsuccessful execution of a READ statement, does not alter the contents of
the depending item.
•
Establishing the Length of a Variable-Length Record
When the run-time routines execute a REWRITE or WRITE statement referencing
a file of variable-length records, the number of character positions in the record
written is determined:
°
If length-var is specified, by the content of the data item referenced by
length-var.
°
If length-var is not specified and the record does not contain a variable-
occurrence data item, by the number of character positions in the record (as
specified in the record description).
°
If length-var is not specified and the record contains a variable-occurrence
data item, by the sum of the size of the fixed portion and that portion of the
table described by the number of occurrences at the time of execution of the
output statement.
Example 7-3. Variable-Length Record
RECORD IS VARYING IN SIZE FROM 100 TO 144 CHARACTERS