TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

Execution of Rexx program


After completing this chapter, you will be able to describe the various methods of executing a REXX exec.


Execution of Rexx program:

There are two ways to execute the REXX exec.

  1. Executing Explicitly

  2. Executing Implicitly


Executing Explicitly:

To execute explicitly, we have to use EXEC command followed by the data set name, which is done as follows

TSO EX 'RACFID.SOURCE.EXEC(SAMPLE)' where 'RACFID.SOURCE.EXEC' is the PDS name and 'SAMPLE' is the REXX exec name.


Executing Implicitly:

The implicit execution is done as follows:

TSO SAMPLE where SAMPLE is the exec name

Implicit execution can be done only if the PDS containing REXX programs has allocated to the system files (SYSEXEC or SYSPROC) using the TSO alloc command or the PDS is allocated to an application CLIST or EXEC using TSO ALTLIB command.


Example:

/*******REXX**********/
Say 'This is the sample REXX exec'

TSO EX 'RACFID.SOURCE.EXEC(SAMPLE)' EX – EXECUTING EXPLICITLY
TSO SAMPLE – EXECUTING IMPLICITLY

SAMPLE OUTPUT: This is the sample REXX exec

Rexx Example:

REXX program which uses the basics of REXX, so far we explained.

/* REXX */
SAY 'ENTER THE FIRST NUMBER:' PULL NUMBER1
SAY 'ENTER THE SECOND NUMBER:' PULL NUMBER2
SAY 'ENTER THE THIRD NUMBER:' PULL NUMBER3
GREAT = VALUES (NUMBER1, NUMBER2, NUMBER3)
SAY 'GREATEST NUMBER IS:' GREAT
EXIT 0
VALUES:
IF NUMBER1 > NUMBER2 THEN
    IF NUMBER1 > NUMBER3 THEN
        XE=NUMBER1
    ELSE
        XE=NUMBER3
ELSE
    IF NUMBER2 > NUMBER3 THEN
        XE=NUMBER2
    ELSE
        XE=NUMBER3
RETURN XE

Explanation:

  • This exec will get the input of three numbers from the user.

  • And displays the greatest of three numbers.

  • Coding standards that needs to be followed.

  • Provide proper comments as needed.

  • Indent the code, since REXX instructions can begin in any column.


Summary:

  • REXX program can be explicitly executed through TSO command.


Test Your Understanding:

  1. Which of the following is true? REXX is a:
    1. Programming language
    2. Interpreted command language
    3. Procedural language
    4. All of the earlier

  2. The different types to execute a REXX exec are:
    1. Implicit
    2. Explicit
    3. Both
    4. None of the above

If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal