The REVERSED phrase of the OPEN statement is classed as an obsolete element in the ANSI'85 standard and is scheduled to be
deleted from the next full revision of the ANSI Standard.
All dialects in this COBOL implementation fully support this syntax. The FLAGSTD Compiler directive can be used to detect
all occurrences of this syntax.
Although it is a part of the standard COBOL definition, the REVERSED phrase of the OPEN statement is explicitly excluded from
the X/Open COBOL language definitions and should not be used in a conforming X/Open COBOL source program.
The OPEN statement allocates system resources for a synchronization data item and initializes the data item.
The key words INPUT, OUTPUT, I-O, and EXTEND specify the type of input-output operations intended for the file through the file connector and establish the open mode. (See table 14-4, Permissible Combinations of Statements and OPEN Modes.)
A file is available if it is physically present and is recognized by the file handling system. Table 1, Opening Available and Unavailable Files (file not currently open), shows the results of opening available and unavailable files that are not currently open. Table 2, Opening Available Shared Files that are Currently Open by Another File Connector, shows the results of opening available and unavailable files that are currently open by another file connector.
Open Mode | File is Available | File is Unavailable |
---|---|---|
INPUT | Normal open | Open is unsuccessful |
INPUT (optional file) | Normal open | Normal open; the first read causes the at end condition or invalid key condition |
I-O | Normal open | Open is unsuccessful |
I-O (optional file) | Normal open | Open causes the file to be created |
OUTPUT | Normal open; the file contains no records | Open causes the file to be created |
EXTEND | Normal open | Open is unsuccessful |
EXTEND (optional file) | Normal open | Open causes the file to be created |
Open request | Most Restrictive Existing Sharing Mode and Open Mode | |||||
---|---|---|---|---|---|---|
Sharing with no Other | Sharing with Read Only | Sharing with All Other | ||||
extend/ I-O/ input/ output | extend/ I-O/ output | input | extend/ I-O/ output | input | ||
SHARING WITH NO OTHER | EXTEND/ I-O/ INPUT/ OUTPUT/ | Unsuccessful open | Unsuccessful open | Unsuccessful open | Unsuccessful open | Unsuccessful open |
SHARING WITH READ ONLY | EXTEND/ I-O | Unsuccessful open | Unsuccessful open | Unsuccessful open | Unsuccessful open | Normal open |
INPUT | Unsuccessful open | Unsuccessful open | Normal open | Unsuccessful open | Normal open | |
OUTPUT | Unsuccessful open | Unsuccessful open | Unsuccessful open | Unsuccessful open | Unsuccessful open | |
SHARING WITH ALL OTHER | EXTEND/ I-O | Unsuccessful open | Unsuccessful open | Unsuccessful open | Normal open | Normal open |
INPUT | Unsuccessful open | Normal open |