Pages

Showing posts with label simple rexx execute. Show all posts
Showing posts with label simple rexx execute. Show all posts

Saturday, June 14, 2014

REXX Basics

What is REXX?

•REstructered eXtended eXecutor language
•Developed by M.F.Cowlishaw of IBM U.K.
•Introduced in 1983
•Highly versatile programming language
•Can  be intermixed with commands to different host environments

Setting up to Execute REXX Programs on TSO/ISPF

This is what you can do so that you will be able to execute your REXX program on MVS TSO/ISPF.

There are several ways that this can be done. 

1. The simpliest of them all, dumb way. 

If you do it this way, you can’t create and use REXX external subroutines. 
Briefly: no setup is done. 
You just put your REXX program in a PDS member or even in a sequential file. 
Then execute it this way from the command line of any ISPF panel: 

TSO EXEC 'the-name-of-the-PDS(member-name)' EXEC

2. The "Ideal way" from the point of view of the person executing the program. 
not so ideal for the technical support personnel.

Your REXX program is a member in a PDS that everyone has read access to. 
This PDS name is specified in the TSO Logon Procedure that is executed everytime you and everyone logs on. 
This is a part of it.

//TSOSTEP EXEC PGM=IKJEFT01
//SYSTSPRT DD TERM=TS 
//SYSEXEC DD DSN=the-name-of-the-pds,DISP=SHR
// DD DSN=name-of-another-pds,DISP=SHR


3. You wait till you get into ISPF. Then you type in the following in option 6, or on the ISPF panel command line, preceded by the word TSO:


ALTLIB DEACTIVATE APPL(EXEC) 
ALTLIB ACTIVATE APPL(EXEC) DA('name-of-your-REXX-PDS')

You have to do this on both halves of a split screen and every time you log on. 
A suggested way of doing this is to put the above command in a CLIST or REXX program, then execute the program. 
This example shows a CLIST.

ALTLIB DEACTIVATE APPL(EXEC) 
ALTLIB ACTIVATE APPL(EXEC) DA('name-of-your-REXX-PDS') 
This example shows a REXX program.

/* REXX */ 
"ALTLIB DEACTIVATE APPL(EXEC)" 
"ALTLIB ACTIVATE APPL(EXEC) DA('name-of-your-REXX-PDS')"

REXX - HELLO WORLD

Let try out our first REXX module and enjoy.

/* REXX */
SAY 'HELLO WORLD'

Put this in a PDS member (ideally, create one like Letmetry.REXX.EXEC).

Now, there are various ways by which you can invoke a REXX program.


1. From ISPF main panel, run the command

TSO EX 'Letmetry.REXX.EXEC(HELLO)' EX


2. From READY Prompt, run the command,

EX 'Letmetry.REXX.EXEC(HELLO)' EX



3. Using 3.4, browse to the PDS Letmetry.REXX.EXEC.
Before the member HELLO, enter EX and press enter.



4. You can also run the REXX program through a JCL. The following is the JCL step that you need.


//REXXBTCH EXEC PGM=IKJEFT01
//SYSEXEC DD DSN=MYHQL.REXX.EXEC,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
%HELLO
/*

The above are the manual ways. Below are the advanced methods which needs special privileges

IF you have added the PDS to SYSEXEC then we can execute even by below commands. This needs admin access, Just execute this once and using the below methods you can easily execute them

/* rexx */
/* Rexx lib */
DSNAME = 'BNKSPS.TSO.CMD'
DDNAME = 'SYSPROC'
 /* To get all DSNs already associated to SYSPROC    */
ADDRESS ISPEXEC "QBASELIB" DDNAME "ID(DSLIST)"
 /* ADDRESS ISPEXEC "GETPROF DSLIST" */
say DSLIST;
 /* to allocate DSNs already allocated to SYSPROC plus my DSN */
"ALLOC F("DDNAME") DA("DSLIST",'"DSNAME"') SHR REUSE"
RETURN


1. You just need to execute command from ISPF,

TSO HELLO


2. From READY prompt, just enter


HELLO