Purpose
Causes the file identified by
file_id to be opened with the attributes specified. .
Syntax
OPEN file_attribute_list[,file_attribute_list]…;
Parameters
file_attribute_list must include the FILE(
file_id) option. It may include any of the following: [TITLE(
s)] [LINESIZE(
n)] [PAGESIZE(
m)] [STREAM] [RECORD] [INPUT] [OUTPUT] [UPDATE] [PRINT] [KEYED] [SEQUENTIAL] [DIRECT], where:
-
file_id
- One or more references to the files to be opened, and bracketed items are file attributes.
-
s
- The name by which the operating system knows the file(s).
-
n
- The maximum number of characters that can be output in a single line for the STREAM file.
-
m
- The maximum number of lines that can be written to the print file without signaling the ENDPAGE condition.
These attributes, including FILE(file_id), may be in any order.
Example
OPEN FILE(F) STREAM INPUT;
OPEN FILE(F) TITLE ('MASTER_FILE.NEW') UPDATE;
OPEN FILE(G) LINESIZE(80) PAGESIZE(60) STREAM OUTPUT PRINT;
Description
Execution of the OPEN statement causes the file identified by file_id to be opened with the attributes specified in the OPEN statement.
The FILE option must be specified and file_id must be a reference that produces a file value. If the file identified by file_id is already open, the OPEN statement is ignored, even if its attributes disagree with those of the already opened file. The program in which file_id is declared should be compiled with the -defext compiler option. For more information on compiler options, see your Open PL/I User's Guide
The OPEN statement opens each specified file with a specified set of attributes that describe both the file and the file access method. The options and attributes may be specified in any order. If specified, line size n and pagesize m must be expressions that produce positive integer values. The default value of the LINESIZE option is 120, and the default value of the PAGESIZE option is 60.
For indexed or VSAM files, the record size is specified in the ENVIRONMENT options in the declaration of the file.