6 Execute REXX programs

The REXX programming language would be very limited in its application if REXX programs could only run online in the TSO/ISPF environment. In this chapter, you will learn how REXX procedures under TSO and ISPF can run using a batch job. The execution of REXX procedures in batch jobs have the following advantages:

6.1Execution of programs in a TSO/ISPF environment

Any programs that are available in a z/OS system are executable in a TSO/ISPF environment. There are two types of programs:

Programs are executable directly in z/OS without any additional support. These are all compiled programs and z/OS utilities.

Programs needing the assistance of an interpreter are all programs written in REXX or CLIST.

The latter are divided into two groups:

REXX and CLIST programs that only need the TSO interpreter environment.

REXX and CLIST programs that additionally need the ISPF environment.

All programs are executable online and in batch. Programs written in REXX or CLIST need for an execution in batch, of course, the appropriate interpreter. When these programs use ISPF services, the ISPF environment must also be available. For means of explaining the entire complex of program execution under a number of conditions, I have developed two REXX programs. Both are very small. They take a parameter and print its content.

TEST1: This program only needs the TSO environment.

TEST2: This program additionally needs the ISPF environment.

Here the source code lists of both programs:

Program 6.1: TEST1: Simple program using the TSO environment only

images

Program 6.2: TEST2: Simple program using the ISPF environment

images

imagesNote:

If this program is running online, then the message is printed using the SETMSG service of ISPF. When it runs in batch, the message uses the SAY command of REXX.

6.1.1Online execution

For the online calling of a program, you do not know whether this is a procedure or a compiled program. Moreover, you do not have to worry about the program requiring ISPF services, because you are already working in ISPF. Nevertheless, you have to know if there are parameters needed for the correct execution.

Programs can be executed online as follows.

You can execute a REXX program by using the edit macro ## contained in the SMART ISPF utilities when the program is currently being edited. This means simply enter in the command line of the editor “## testl This is a text”.

Type in the command line “tso testl This is a text”.

Enter in a DSLIST display panel TEST1 in front of a DSN. In this case, the DSN will be passed to the program as a parameter.

Select the ISPF menu 6 Command and enter in the = = = > line “testl This is a text”.

Insert a CMD command entry in the ISPF command table to execute the program. In this case, you can start the program by entering the command name in the command line of each ISPF panel. See the information to insert a command table entry in the chapter below. The SMART ISPF utility program SLE is a typical candidate for this type of call. See the following command table entry example:

images

I will not demonstrate the online execution of the above program here. This is so simple that I really do not have to show it.

6.1.2 Batch execution

Executing a REXX program in a batch job is not as easy as in the online environment because an appropriate JCL program is required which is submitted to the batch system environment for execution. This is initially a difficult thing, because you need to know how the JCL must be designed to operate properly. In my work in the TSO / ISPF, this problem occurred earlier repeatedly. Therefore, long time ago I developed two EDIT macros that relieve me of creating each required JCL. These two edit macros are:

#TSOB to submit and execute REXX programs which only need the TSO environment.

#ISPFB to submit and execute REXX programs which additionally need the ISPF environment.

If a program requires input parameters, these can entered when calling. I executed the two programs TEST1 and TEST2 each with the correct edit macro. I have added the resulted JCL programs below.

JCL 6.1: JCL to execute TEST1 in a native TSO environment

images

When running this program, the following list is printed. It can be found in SDSF.

images

JCL 6.2: JCL to execute TEST2 in a TSO/ISPF environment

images

When running this program, the following list is printed. It can be found in SDSF.

images

I think you now have the necessary knowledge to understand the following chapters.

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

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