Using IRXJCL to run a REXX exec in MVS batch

To run an exec in MVS™ batch, specify IRXJCL as the program name (PGM= ) on the JCL EXEC statement. Specify the member name of the exec and one argument you want to pass to the exec in the PARM field on the EXEC statement. You can specify only the name of a member of a PDS. You cannot specify the name of a sequential data set. The PDS must be allocated to the DD specified in the LOADDD field of the module name table. The default is SYSEXEC. Figure 1 shows example JCL to invoke the exec MYEXEC.
Figure 1. Example of invoking an exec from a JCL EXEC statement using IRXJCL
//STEP1    EXEC PGM=IRXJCL,PARM='MYEXEC A1 b2 C3 d4'
//*
//STEPLIB
//* Next DD is the data set equivalent to terminal input
//SYSTSIN  DD   DSN=xxx.xxx.xxx,DISP=SHR,...
//*
//* Next DD is the data set equivalent to terminal output
//SYSTSPRT DD   DSN=xxx.xxx.xxx,DISP=OLD,...
//*
//* Next DD points to a library of execs
//* that include MYEXEC
//SYSEXEC  DD   DSN=xxx.xxx.xxx,DISP=SHR
Note: If you want output to be routed to a printer, specify the //SYSTSPRT DD statement as:
//SYSTSPRT DD   SYSOUT=A
As Figure 1 shows, the exec MYEXEC is loaded from DD SYSEXEC. SYSEXEC is the default setting for the name of the DD from which an exec is to be loaded. In the example, one argument is passed to the exec. The argument can consist of more than one token. In this case, the argument is:
A1 b2 C3 d4
When the PARSE ARG keyword instruction is processed in the exec (for example, PARSE ARG EXVARS), the value of the variable EXVARS is set to the argument specified on the JCL EXEC statement. The variable EXVARS is set to:
A1 b2 C3 d4

The MYEXEC exec can perform any of the functions that an exec running in a non-TSO/E address space can perform. See Writing execs that run in Non-TSO/E address spaces for more information about the services you can use in execs that run in non-TSO/E address spaces.

IRXJCL returns a return code as the step completion code. However, the step completion code is limited to a maximum of 4095, in decimal. If the return code is greater than 4095 (decimal), the system uses the rightmost three digits of the hexadecimal representation of the return code and converts it to decimal for use as the step completion code. See Return codes for more information.