COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
Table 17 Relationship Between File Organization and Access Mode (continued)
Access Mode
DynamicRandomSequentialFile Organization
NEXT statements) or
randomly (with READ
statements).*
or alternate record key value
(record keys are fields within
each record). If records with
duplicate alternate key
values exist, the order of
retrieval is either by prime
key or by date of entry. To
specify that retrieval order is
by date of entry, set a file
attribute with FUP.*
Program can select records
sequentially (with READ
Program can select records
from anywhere in the file.
Program can select records
in increasing order of prime
Queue
NEXT statements) orrecord key value (record
randomly (with READ
statements).
keys are fields within each
record). To specify that
retrieval order is by date of
entry, set a file attribute with
FUP.
* If the file has alternate keys, this characteristic also applies to the alternate keys. For a description of Tandem reference
format, see Reference Format for Source Program Lines.
Open Mode
The open mode is a dynamic attribute of a file connector; it controls which file operations are
permitted. In HP COBOL the status of a file connector always includes an open mode.
Table 18 File Open Modes
Statements AllowedFile Operations AllowedMode
UNLOCKFILENoneLocked
OPENExecution of OPEN statement to associate file connector with
its physical file
Closed
Record retrieval operationsInput READ
CLOSE
Record creation operations (deletes existing records upon
opening file)
Output WRITE
CLOSE
Record creation operations (retains existing records upon
opening file)
Extend WRITE
CLOSE
Record retrieval, creation, deletion, and replacement operations
(as allowed by file organization and access modes)
I-O READ
WRITE
REWRITE
DELETE*
CLOSE
* Relative or indexed file only
A file connector that is open in any mode can be closed by a CLOSE statement, which dissociates
the file connector from the physical file and sets the open mode state to Closed or Locked (see
CLOSE (page 304)).
An internal file connector that is open in any mode can be implicitly closed by a CANCEL statement
(see CANCEL (page 301)).
Data Structures 83










