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


Functions supported for the I/O routine

z/OS TSO/E REXX Reference
SA32-0972-00

The function to be performed by the I/O routine is specified in parameter 1. The valid functions are described below.
INIT
The routine performs any initialization that is required. During the initialization of a language processor environment, the I/O routine is called to initialize I/O processing.
OPENR
The routine opens the specified DD for a read operation if the DD is not already open. The ddname is specified in parameter 4.

The I/O routine returns the address of the data set information block in parameter 2. It returns the length of the data set information block (DSIB) in parameter 3. Data set information block describes the block in more detail.

The routine opens the specified DD for a write operation if the DD is not already open. The ddname is specified in parameter 4.

The I/O routine returns the address of the data set information block in parameter 2. It returns the length of the data set information block (DSIB) in parameter 3. Data set information block describes the block in more detail.

OPENX
The routine opens the specified DD for an update operation if the DD is not already open. The ddname is specified in parameter 4.

The I/O routine returns the address of the data set information block in parameter 2. It returns the length of the data set information block (DSIB) in parameter 3. Data set information block describes the block in more detail.

READ
The routine reads data from the DD specified in parameter 4. It returns the data in the buffer pointed to by the address in parameter 2. It also returns the number of the record that was read in the line number parameter (parameter 5).

The READ and READX functions are equivalent, except that the data set is opened differently. Subsequent read operations to the same data set can be done using either the READ or READX function because they do not reopen the data set.

If the data set to be read is closed, the routine opens it for input and then performs the read.

READX
The routine reads data from the DD specified in parameter 4. It returns the data in the buffer pointed to by the address in parameter 2. It also returns the number of the record that was read in the line number parameter (parameter 5).

If the data set to be read is closed, the routine opens it for update and then performs the read.

The READ and READX functions are equivalent, except that the data set is opened differently. Subsequent read operations to the same data set can be done using either the READ or READX function because they do not reopen the data set.

WRITE
The routine writes data from the specified buffer to the specified DD. The buffer is pointed to by the address in parameter 2 and the ddname is specified in parameter 4.

If the data set is closed, the routine first opens it for output and then writes the record. For sequential data sets, if the data set is allocated as OLD, the first record that is written after the data set is opened is written as record number 1. If a sequential data set is allocated as MOD, the record is added at the end of the data set.

Rule: MOD cannot be used to append data to a member of a PDS. You can use MOD only when appending information to a sequential data set. To append information to a member of a PDS, rewrite the member with the additional records added.

When a data set is opened for update, the WRITE function is used to rewrite the last record that was retrieved by the READ or READX function. You can optionally use the line number parameter (parameter 5) to ensure that the number of the record being updated agrees with the number of the last record that was read.

TERM
The routine performs cleanup and closes any opened data sets.
CLOSE
The routine closes the DD specified in parameter 4. The CLOSE function permits data sets to be freed and reallocated.

The CLOSE function is allowed only from the task under which the data set was opened. If CLOSE is requested from a different task, the request is ignored and a return code of 20 is returned.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014