COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-146
OPEN
•
Labeled Files
When the LABEL RECORDS clause in the file description entry indicates that label
records are present, the beginning file or reel labels are processed in accordance
with the conventions for the specified open mode. If the file is opened for INPUT or
EXTEND, the label records are verified. If the file is opened for OUTPUT, the label
records are created. If the device assigned is not a tape, the LABEL RECORDS
clause is ignored.
•
File Position Indicator
The file position indicator specifies the next record to be accessed within the
opened file during certain sequences of input-output operations. For files opened
for INPUT or I-O, it is defined to be just before the first record in the file. For files
opened for OUTPUT or EXTEND, it is undefined.
When a file is opened for OUTPUT, run-time routines position the file at its
beginning point. The first WRITE statement executed for the file creates the first
logical record in the file.
When a file is opened for EXTEND, run-time routines position the file to point
immediately following the last existing logical record, which is defined:
If a file opened for EXTEND is empty, the first WRITE statement executed for the
file creates the first logical record. If the file is not empty, the first WRITE statement
executed for the file creates the successor record to the current last record.
If a file opened for EXTEND is an Enscribe unstructured file, its size must be a
multiple of the record size.
•
Key of Reference
For a relative file, the key of reference is the relative key. For an indexed or queue
file, the key of reference is the prime record key.
•
Locked System Files
An HP COBOL program cannot open a system file that it closed and locked earlier
in its current execution.
File Organization Last Existing Record
Sequential Last record written to the file
Relative Existing record with highest relative record number
Indexed or queue Existing record with highest prime record key value