5The TSO/E REXX commands

In addition to the normal TSO commands, there are some commands that execute the TSO/E specifically for REXX. These commands are like all TSO commands, using literals to send them to the TSO. Some of these commands are only executable when called up from a REXX procedure. I would like to present the most important commands here.

imagesNote

In REXX on other platforms, these commands are not available. For example, the EXECIO command is not available in OOREXX. This is really a deficit of OOREXX!

5.1EXECIO – Read and write data sets

This is the most widely used TSO/E REXX command. EXECIO uses the QSAM method of z/OS. This means that all advantages and disadvantages of this access method are also applicable for EXECIO.

Remarks:

To run an EXECIO command, a DD name must exist that is named in the EXECIO command. When running a REXX procedure in a batch job, this can also be done by a DD statement in the JCL.

The EXECIO command can read data from the data stack as well as write data to the data stack.

The EXECIO command can read the data into a stem as well as write data from a stem. In this case, the name of the stem must be specified in the parameter field.

The file specified with the DD statement can also be a member of a PDS or PDSE.

When writing data records that are longer than the LRECL of the file, the records will be truncated and EXCECIO completes the operation without an error being ex- plicitly reported. However, in this case, the return code 1 is returned by the command EXECIO.

Records can be individually read and written. However, this is rather rare in practice, as this would slow down the process.

Format:

"EXECIO lines iotyp ddname (parms"

linesSpecifies the number of records to be read or written:
0 → no records are written or read.
* → all records are written or read.
n → number of records that are written or read.
iotypDISKRRead operation.
DISKW Write operation.
ddnameThis is the name of an already allocated DD.
parmsSTEM name. Is the name of a stem from which is written or into which is read.
OPEN The data set shall be opened. OPEN will automatically be performed when records are read or written. Normally, this option is never used.
FINIS The file will be closed when the I/O operation ends.

Program 5.1: EXECIOT – Example for the TSO function EXECIO

images

The following table contains descriptions of the statements of this small test program:

LinesExplanation
05Allocation of member PROX.BOOK.REXX(EXECIOD) as a sequential file named DD OUT.
06Empty the file without deleting it.
07-14Assigning lines to Stem A. The line A.1 is much longer than the LRECL 80 of the data set.
15Store the number of records in stem A.
16Write stem A. into member EXECIOD and CLOSE the data set.
17Set A.0 to zero.
18Read all records of the file. A.0 now contains the number of records, namely 8
19-20Change records 5 and 6 in stem A.
21Write stem A. again into member EXECIOD and CLOSE the data set.
22Free the DD name OUT. The data set PROX.BOOK.REXX(EXECIOD) is also freed.

Here you can now see the contents of the member EXECIOD after the above program is running:

images

As you can see, the first record was shortened to LRECL=80 when writing the member EXECIOD.

5.2DELSTACK – delete data stack contents

Function:

This command will delete data stacks.

Deletes the last opened data stack.

If no data stack was open then the original data stack will be deleted.

This command is mainly used to delete the current data stack.

5.3DROPBUF – Delete data stack buffers

Function:

Use this command to delete data stack buffers that were previously created. The command has one operand. This indicates what number of the buffer was cleared. If no operand is specified, the last with MAKEBUF created buffer will be cleared.

5.4TSO Commands

All TSO commands are usable in REXX programs. In addition to the TSO commands discussed so far, I will now explain some more TSO commands that are very useful for programming REXX applications. Important commands are ALLOC, FREE, LISTDS, SUBMIT, EXEC.

Rules:

As discussed above, all strings which are found in REXX programs and are not recognized by the REXX interpreter, will passed to the currently active host command environment for execution.

When a REXX program starts, then the host command environment for TSO is active. Therefore, an ADDRESS TSO command is not necessary in this case. As long as you do not switch the host command environment to another subsystem, can you execute TSO commands simply by writing them in a program line surrounded by apostrophes.

Example 1: Simple allocation of an existing data set.

Example 3: The TSO command LISTCAT is used to print a catalog extract.

images

If this small program is executed, the following list will appear:

images

I truncated some lines on the right.

Remark:

Generally, all commands of the Access Method Services are usable as TSO commands and thus also with REXX.

See manual: z/OS DFSMS Access Method Services for Catalogs

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.27.91