COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-149
OPEN
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.
Files Assigned to Terminals
Any file assigned to a terminal 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 9-6. Open Modes for Files Assigned to Processes
Open Mode Action
INPUT 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 the PROMPT phrase, is the only I-O statement
that can be executed on the file; however, prompts are ignored in this open
mode.
OUTPUT or
EXTEND
If the process has a device subtype of 31, it is a spooler process, treated
like a printer. If the file description entry for the file includes a LINAGE
clause, or the file was opened by the routine COBOL85^SPECIAL^OPEN
or COBOL_SPECIAL_OPEN_, it is assumed to be a printer or a spooler
process. Carriage-control messages are sent to the file, and it can have a
LINAGE clause in its file description entry. WRITE, with or without the
ADVANCING phrase, is the only I-O statement that can be executed on the
file. Lines of output are held until a subsequent write or close operation, and
consecutive spacing operations due to ADVANCING clauses are
consolidated to minimized output operations.
If the process does not meet the criteria stated earlier, it is assumed to be
an ordinary process. No consolidation of operations occurs, and each line is
written to the process immediately. No control information or extra blank
lines are written to the process.
I-O 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 and WRITE statements can be executed on the file, but
DELETE, REWRITE, and START statements cannot.