z/OS TSO/E CLISTs
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Opening a file

z/OS TSO/E CLISTs
SA32-0978-00

The OPENFILE statement has the following syntax:
OPENFILE filename  {INPUT }  /* to read records from the file
                   {OUTPUT}  /* to write records to the file
                   {UPDATE}  /* to update records in the file

To open a data set for I/O, you must allocate the data set to a file name, then use that file name on the OPENFILE statement. To preserve data integrity, after the file is opened for I/O, CLIST performs only one level of substitution against the file name variable. That is, after the file name is substituted with a file record, and to ensure the file record can be saved in its original format, CLIST does not re-scan the record.

To allocate the data set to a file name, use the ALLOCATE command with the FILE keyword. The file name is an arbitrary value; you can create it on the allocation.

For example, you can code the following:
⋮
allocate file(paycheks) da('d58tan1.checks.data') shr
OPENFILE PAYCHEKS
⋮
You can also code the file name as a symbolic variable as follows:
⋮
SET FILEID= PAYCHEKS
⋮
allocate file(&FILEID) da('d58tan1.checks.data') shr
OPENFILE &FILEID
⋮
You can open a member of a PDS after allocating the member to a file name, for example:
allocate file(income) da('d58tan1.receipts(july)') shr
OPENFILE INCOME
However, do not use OPENFILE statements to open more than one member of a PDS for output at the same time.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014