COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-144
OPEN
Usage Considerations:
•
Associating COBOL File Names With System File Names
Before you can open a file, you must associate its COBOL file name with the name
of a system file name, using one of:
°
The ASSIGN clause of the file-control entry for the COBOL file
(see FILE-CONTROL Paragraph)
°
The TACL command ASSIGN
(see ASSIGN Command)
°
A DEFINE of the class MAP, SPOOL, or TAPE
(see DEFINEs)
°
The COBOLASSIGN or COBOL_ASSIGN_ routine
(see COBOLASSIGN and COBOL_ASSIGN_)
•
Devices That You Can Open
The OPEN statement can open devices that accept normal read and write
operations (as opposed to read and write operations that require special control
information). This table shows which file organizations are compatible with which
devices:
•
Successful and Unsuccessful Open Operation
Execution of an OPEN statement sets an I-O status code for each file specified in
the statement. Successful opening of a file sets the I-O status code of that file to
“00,” “05,” “07,” or “97.” Unsuccessful opening of a file sets the I-O status code to
one of the values in Table 9-4 and causes execution of any applicable USE AFTER
EXCEPTION CONDITION procedure.
If you declared a file-status data item for a file (see FILE-CONTROL Paragraph),
the process stores the I-O status code in that data item. For an extensive
discussion of I-O status codes, see I-O Status Code.
File Organization Devices Allowed Device Type Numbers
Relative, indexed, or queue Disk file 3
Sequential without LINAGE Process
$RECEIVE
Disk file
Tape
Printer
Page mode terminal
Envoy line
Card reader
X25 treated as a process
COMM system manager
0
2
3
4
5
6
7
8
9
50
Sequential with LINAGE Process
Printer
0
5