COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-147
OPEN
•
Opening a File Multiple Times, Simultaneously
An HP COBOL program can open one system file under more than one COBOL
file name. This is particularly helpful when you are developing a server. You can
open $RECEIVE twice—once for INPUT and once for OUTPUT—and use TACL
ASSIGN commands to make one terminal (or obey file) your input simulator and
another terminal your output monitor.
If an HP COBOL program opens a file with a certain COBOL file name, it must
close that COBOL file (using that COBOL file name) before it can open it again
with that COBOL file name.
•
Operations by Other Input-Output Statements
Before any other input-output statement can operate upon a file, an OPEN
statement must make the file accessible.
Whether you can use a verb to operate on a file depends on the mode in which
you open the file (INPUT, OUTPUT, I-O, or EXTEND), the file’s organization and
access mode, and the device with which the file is associated.
The READ, WRITE, REWRITE, START, and DELETE statements can operate only
on files opened with certain options. Table 9-5 summarizes the open modes that
make files having different organizations and access modes accessible to these
statements.
The START and DELETE statements can operate only on files associated with disk
devices.
The REWRITE statement can operate only on files associated with disk devices.
The CLOSE, LOCKFILE, UNLOCKFILE, and UNLOCKRECORD statements can
operate on any open file.
•
Direct Calls to NonStop Operating System I-O Procedures
If you open a file with the OPEN statement, do not perform I-O operations on that
file by making direct calls to NonStop operating system I-O procedures. If you do,
the results are undefined.