You are here: Home > Knowledge Refreshers

KR-228* How to execute REXX codes

 

Addendum to the REXX crash course series.

 

4 ways to execute REXX codes

 

1.) Foreground execution

 

Prefix member name by EXEC within the member listing screen – the method we’ve been using so far.

 

2.) Another foreground method

 

Type TSO EXEC 'pds(rexx-member)' on the command line on any screen.

 

3.) Foreground again (most commonly used method)

  • To run the rexx exec without giving specifying the path we can allocate the PDS containing the REXX member to SYSEXEC or SYSPROC -> these are the files that are searched to locate execs.
  • Usually SYSPROC contains all user created CLISTS; so we can append our dataset to this (SYSPROC is like a dd-name to which datasets can be concatenated) -> use the ISRDDN command to check datasets allocated in your session.
  • To allocate datasets to SYSPROC use the following TSO command: CONCAT FILE(SYSPROC) DA('pds name') SHR REUSE
  • Now if your REXX code is called CREATOR then you can just say TSO CREATOR on any screen to invoke the tool. We can also say: %CREATOR
  • One question is should I execute the CONCAT command each time I log into mainframes?
    Yes - there are a couple of ways to circumvent this: take advantage of the initial logon screen where you can specify commands to be executed on logging in. Another option is that your mainframe might already have a specific dataset that is executed for each user on logging in; in this case just add the CONCAT step to this file.

4.) Running a REXX exec in batch

 

Write a jcl step to execute the tso program IKJEFT01.

In the SYSTSIN card we can give the TSO commands to be executed.

Ex:

//SYSTSIN DD * EX 'TEST.SS.REXX.EXEC(CREATOR)'

/*

If you want to pass arguments to your program, then use:

//SYSTSIN DD * %CREATOR arg1 arg2

/*

(CREATOR code should then have an ARG statement to capture the arguments).