Running an exec in the TSO/E address space

Start of changeYou can invoke a REXX exec in the TSO/E address space in several ways. To invoke an exec in TSO/E foreground, use the TSO/E EXEC command processor to either implicitly or explicitly invoke the exec. To invoke an exec explicitly, use the EXEC command, specifying the name of the data set and member to be executed. For example:
EXEC 'USERID.MYREXX.EXEC(TEST4)'EXEC 
End of change
Start of changeTo invoke an exec implicitly by just specifying the member name of an exec, place the exec in a data set allocated to your SYSEXEC DD or SYSPROC DD. SYSEXEC contains only REXX execs, but SYSPROC can contain both REXX execs and CLISTs. To distinguish REXX execs from CLISTs, execs that are placed in SYSPROC should always start with a comment with the word "REXX" in line one, such as : /* REXX */. So if TEST1 is a REXX exec in a SYSEXEC or SYSPROC data set, you might invoke it implicitly with:
%TEST1
End of change

Start of changeFor more information about how to invoke an exec in TSO/E foreground, see z/OS TSO/E REXX User's Guide.End of change

You can run a REXX exec in TSO/E background. In the JCL, specify IKJEFT01 as the program name (PGM= ) on the JCL EXEC statement. On the EXEC statement, specify the member name of the exec and any arguments in the PARM field. For example, to execute an exec that is called TEST4 that is in data set USERID.MYREXX.EXEC, use the following JCL:
//TSOBATCH  EXEC PGM=IKJEFT01,DYNAMNBR=30,REGION=4096K,PARM='TEST4'
//SYSEXEC   DD   DSN=USERID.MYREXX.EXEC,DISP=SHR
You can also invoke an exec implicitly or explicitly in the input stream of the SYSTSIN DD statement.
//TSOBATCH  EXEC PGM=IKJEFT01,DYNAMNBR=30,REGION=4096K
//SYSEXEC   DD   DSN=USERID.MYREXX.EXEC,DISP=SHR
//SYSTSPRT  DD   SYSOUT=A
//SYSTSIN   DD   *
  %TEST4
     or
  EXEC           'USERID.MYREXX.EXEC(TEST4)'EXEC
/*
//

See z/OS TSO/E REXX User's Guide for more information about invoking execs.

From a program that is written in a high-level programming language, you can use the TSO service facility to invoke the TSO/E EXEC command to process a REXX exec. z/OS TSO/E Programming Services describes the TSO service facility in detail.

You can also invoke a REXX exec from an application program by using the exec processing routines IRXJCL and IRXEXEC. Although IRXJCL and IRXEXEC are primarily used in non-TSO/E address spaces, they are programming interfaces to the language processor that you can use to run an exec in any address space, including TSO/E. For example, in an assembler or PL/I program, you could invoke IRXJCL or IRXEXEC to process a REXX exec.

The IRXEXEC routine gives you more flexibility in processing an exec. For example, if you want to preload an exec in storage and then process the preloaded exec, you can use IRXEXEC. Exec processing routines - IRXJCL and IRXEXEC describes the IRXJCL and IRXEXEC interfaces in detail.

Note: You cannot invoke a REXX exec as authorized in either the foreground or the background.