COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

Table 63 I-O Statements You Can Use in Different Open Modes (continued)
Open Mode
EXTENDI-OOUTPUTINPUTI-O Statement
R = Relative
S = Sequential
S* = Sequential (but only for START specifying an alternate key)
S = SequentialAcc is the file’s access mode:
R = Random
D = Dynamic
ALL means all organizations and access modes
Nonexistent Files
When the INPUT, I-O, or EXTEND phrase applies and the SELECT clause includes the
OPTIONAL phrase, the run-time routines determine whether or not the file is present.
If the file is not present, one of these occurs:
If the I-O or EXTEND phrase applies, the open operation creates a file. This creation
occurs as if these statements were executed in the order shown:
OPEN OUTPUT file-name.
CLOSE file-name.
The OPEN statement as specified in the source program is then executed. If the file is
defined to have alternate keys, the creation attempt fails because you cannot create such
files with COBOL verbs. They must be created by an application outside the HP COBOL
language (for example, by FUP, the File Utility Program, or by using ENTER to call Enscribe
routines).
If the creation attempt succeeds, then the file exists. Files Assigned to Disk Devices explains
the rules for existing disk files.
After a successful open operation that creates a file in the manner described, the I-O
status code is “05,” rather than “00” (as it would have been if the operation had opened
an existing file).
Although no Guardian file is open, if the file might be created later by the current or
another program, you must close the file before opening it in COBOL.
If the INPUT phrase applies, the file position indicator is set to indicate that an optional
file is not present. In this case, the I-O status code is “05” and the other steps described
later are omitted from the open operation.
When the INPUT, I-O, or EXTEND phrase applies, the file is not described as OPTIONAL, and
the file is not present at run-time, the open operation terminates immediately with I-O status
code “35.
Files Assigned to Processes
Any file assigned to a process must be described with sequential organization without alternate
keys in its file-control entry. The mode in which you open the file determines its use.
Table 64 Open Modes for Files Assigned to Processes
ActionOpen Mode
The file is treated as if it were a terminal. No carriage-control messages are sent to the
file, and it cannot have a LINAGE clause in its file description entry. READ, with or without
INPUT
OPEN 383