Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

OPEN statement

The OPEN statement associates a file with a data set. It merges attributes specified on the OPEN statement with those specified on the DECLARE statement. It also completes the specification of attributes for the file, if a complete set of attributes has not been declared for the file being opened.

Read syntax diagramSkip visual syntax diagram         .-,-----------------.
         V                   |
>>-OPEN----| options-group |-+--;--| options-group: |----------->
 
                         .-STREAM-----.  .-INPUT------.
>--FILE(file-reference)--+------------+--+------------+--------->
                         '-+--------+-'  +-+--------+-+
                           '-RECORD-'    | '-OUTPUT-' |
                                         '-+--------+-'
                                           '-UPDATE-'
 
                 .-BUFFERED-------.
   .-SEQUENTIAL--+----------------+-.
   |             '-+------------+-' |
   |               '-UNBUFFERED-'   |
>--+--------------------------------+--+-------+--+-------+----->
   |         .-UNBUFFERED---.       |  '-KEYED-'  '-PRINT-'
   '-DIRECT--+--------------+-------'
             '-+----------+-'
               '-BUFFERED-'
 
>--+-------------------+--+----------------------+-------------->
   '-TITLE(expression)-'  '-LINESIZE(expression)-'
 
>--+----------------------+------------------------------------><
   '-PAGESIZE(expression)-'
 

The options of the OPEN statement can appear in any order.

FILE
Specifies the name of the file that is associated with a data set.
STREAM, RECORD,
INPUT, OUTPUT, UPDATE,
DIRECT, SEQUENTIAL,
BUFFERED, UNBUFFERED,
KEYED, and PRINT
These options specify attributes that augment the attributes specified in the file declaration. The same attributes need not be listed in both OPEN and DECLARE statements for the same file. For a list of attributes for record and stream input and output, see Table 30.

When a STREAM file is opened, the first GET or PUT statement can specify, with a statement option or format item, the first record to be accessed. The statement option or format item indicates that n lines are skipped before a record is accessed. The file is then positioned at the start of the nth record. If no statement option or format item is encountered, the initial file position is the start of the first line or record. If the file has the PRINT attribute, it is physically positioned at column 1 of the first line or record.

Opening a file that is already open does not affect the file.

TITLE
The content of expression determines what is being designated. For more information on the TITLE attribute refer to the Programming Guide.
LINESIZE

Converted to an integer value, specifies the length in bytes of a line during subsequent operations on the file. New lines can be started by use of the printing and control format items or by options in a GET or PUT statement. If an attempt is made to position a file past the end of a line before explicit action to start a new line is taken, a new line is started, and the file is positioned to the start of this new line. The default line size for PRINT file is 120.

The LINESIZE option can be specified only for a STREAM OUTPUT file.

PAGESIZE

Is evaluated and converted to an integer value, and specifies the number of lines per page. The first attempt to exceed this limit raises the ENDPAGE condition. During subsequent transmission to the PRINT file, a new page can be started by use of the PAGE format item or by the PAGE option in the PUT statement. The default page size is 60.

The PAGESIZE option can be specified only for a file having the PRINT attribute.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)