PreviousJCL Support Overview of TestingNext"

Chapter 18: REXX Support

REXX is a high-level language with extensive facilities for manipulating text. REXX programs can also include host system commands and so can be used in place of TSO CLISTs.

This chapter describes how REXX is supported in Mainframe Express. For more information about the REXX language and how it is used, see the IBM OS/390 TSO/E REXX Reference and IBM OS/390 TSO/E REXX User's Guide.

A REXX program is called an exec. Before running an exec, you need to add the exec to your project, or download it from the mainframe, in the usual way. All REXX execs should start with a comment containing the character string REXX so that they can be distinguished from TSO CLISTs. For example:

/************** REXX **************/

On the PC, REXX execs should have the file extension .rex. By default, they are placed in the REXX source library in the Workgroup location.

Optionally, you can define an exec as a member of a partitioned data set (PDS). The DD names SYSEXEC and SYSPROC are normally used for PDSs containing REXX execs. More than one PDS can be allocated to each of these DD names. A SYSEXEC PDS can contain only execs. A SYSPROC PDS can contain CLISTs and execs.

When you run the exec, if you do not specify the location of the exec explicitly, Mainframe Express uses the following search order to locate it:

  1. SYSEXEC data sets

  2. REXX source library in the Workgroup location

  3. SYSPROC data sets

  4. CLIST source library in the Workgroup location

Mainframe Express interprets an exec as it is run. There are no preceding compilation and linking stages.

Mainframe Express supports the use of REXX execs in the following host environments:

18.1 TSO Interactive Environment

In the TSO interactive environment, you can run a REXX exec in the same way as a CLIST. You can specify the exec that you want to run:

For example, if the exec is named tsotest and is a member of a private PDS named userid.rexx.exec, you can specify one of the following forms:

The final exec keyword identifies it as a REXX exec. You can omit it if the first line of the exec is a comment containing the character string REXX.

If the exec is a member of a PDS allocated to SYSEXEC or SYSPROC, or if SYSEXEC and SYSPROC are not defined but the REXX exec is included in the project, you can simply specify one of the following:

18.2 TSO Batch Environment

You can use the IKJEFT01 utility to set up a TSO batch environment and run a REXX exec in the same way as a CLIST.

For example, the following JCL jobstream runs the REXX exec named tsotest in the PDS named userid.rexx.exec.

//jobname JOB ............
//jobstep  EXEC PGM=IKJEFT01,.........

You can run the JCL jobstream from the Debug menu in the usual way.

18.3 JCL Environment

In the JCL environment, you can use the IRXJCL utility to run a REXX exec.

For example, the following JCL jobstream runs the REXX exec named jcltest in the PDS named userid.rexx.exec that has been allocated to SYSEXEC.

//jobname  JOB ............
input to exec

18.4 Passing Parameters

You can pass parameters to a REXX exec in the usual way, for example:

In the exec named add, you can use an ARG instruction to receive the two parameters, 42 and 21.

18.5 Including Host Commands

You can include a host command in a REXX exec by enclosing it in quotation marks, for example:


The REXX language processor passes the command and any other source code that it does not recognize to the host command environment for execution.

Mainframe Express emulates the TSO and MVS host command environments. It selects the appropriate environment by default on entry to a REXX exec. TSO is selected for the TSO interactive and batch environments and MVS is selected for the JCL environment. If you use a host command that is not recognized by the current environment, the return-code variable RC is set to -3.

You can use the ADDRESS built-in function to find the name of the current environment and the ADDRESS instruction to change it.

18.6 Debugging an Exec

You can use the REXX debugging facility to help you debug an exec. It lets you interact with the exec while it is running and monitor the values of variables.

18.7 Restrictions

The following mainframe REXX facilities are not supported by Mainframe Express:

Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousJCL Support Overview of TestingNext"