Wednesday, September 9, 2009

Tutorial 1: The first REXX program and How to run a REXX Program

The first REXX program is very simple. It calls out the world.

/* REXX */
SAY 'HELLO WORLD'

Put this in a PDS member (ideally, create one like myhlq.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 'myhlq.REXX.EXEC(HELLO)' EX


2. From READY Prompt, run the command,

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


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

The above are the manual methods. What follow below are smart methods to run REXX program.

To understand the smart way, it is first important to undestand the concept of REXX libraries.
When you logon to ISPF, ISPF assigns a pre-defined set of DDNames to few PDS datasets. To view this set, you can enter the command TSO ISRDDN from the ISPF panel.

From the list displayed, the DDnames of interest here are SYSEXEC and SYSPROC. The PDS datasest shown against these DDnames are the PDS that TSO will look for, when you don't specify the PDS name and just specify the REXX program name to run. If you want to run your REXX program the smart way, you need to assign your personal PDS (myhql.REXX.EXEC) to this list for SYSEXEC or SYSPROC.

There are two ways to do this.

i. If your system adminstrator allows, you can run a CLIST or REXX program when you logon to ISPF. This will usually appear as a message when you logon. Ask you system admin if you can do this, as this is the best way to do this.
If it is a CLIST, add the following command in the CLIST,

CONCATD FI(SYSEXEC) DA('myhql.REXX.EXEC')

If it is a REXX, add the following command,

"ALLOC FILE(SYSEXEC) DATASET("'myhql.REXX.EXEC'","'isp.rexx.exec') SHR REUSE"

Note that in this case, you need to specify all the existing allocations to SYSEXEC (from ISRDDN). If you just specify your PDS in the DATASET, then the existing allocations will be lost.

ii. If the system admin does not allow running a REXX/CLIST, then execute the following command one time in your ISPF session.

TSO ALTLIB ACTIVATE APPL(EXEC) DSN('myhlq.REXX.EXEC')

The drawback of this method is that it works only in the session that you execute from. If you have more than one session open using split screens (this is the norm nowadays), you need to execute this command in all your sessions.

So, work out the best way that works for you.

Once the above is done,

4. You just need to execute command from ISPF,

TSO HELLO

5. From READY prompt, just enter

HELLO

6. 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
/*

If you have ISPF services within your REXX, then you need additional DDnames in your JCL step. You will essentially start ISPF in batch and then run the rexx program so that all the ISPF services are available when it runs in batch.

//REXXBTCH EXEC PGM=IKJEFT1B
//ISPLLIB DD DISP=SHR,DSN=USER.ISPLLIB
//ISPPLIB DD DISP=SHR,DSN=ISP.SISPPENU
//ISPMLIB DD DISP=SHR,DSN=ISP.SISPMENU
//ISPSLIB DD DISP=SHR,DSN=ISP.SISPSENU
//ISPPROF DD DSN=&TEMPPROF,DISP=NEW,PASS,DELETE)
//ISPLOG DD SYSOUT=*,DCB=(RECFM=VA,LRECL=125,BLKSIZE=129)
//ISPTABL DD DISP=SHR,DSN=&TEMPPROF
//ISPTLIB DD DISP=SHR,DSN=&TEMPPROF
// DD DISP=SHR,DSN=ISP.SISPTENU
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSEXEC DD DISP=SHR,DSN=MYHLQ.REXX.EXEC
//SYSTSIN DD *
ISPSTART CMD(%HELLO)
/*

Add additional DDnames as required in your installation. Contact your system admin for the correct list of concatenations required.


© Paras Doshi, 2009.
Page copy protected against web site content infringement by Copyscape

16 comments:

  1. Thanks allot for providing so useful information at this place. It is a really nice place to share your views and get useful information.
    So kindly keep updating this page.
    Thanks allot

    ReplyDelete
  2. Very useful information. Thanks a lot :)

    ReplyDelete
  3. Very usefull dude! Thanks for the information. k\keep up the good work.!!

    ReplyDelete
  4. Very Good Information... Thanks for the Article..

    ReplyDelete
  5. Thanks mate, my team lead was going to stab me tomorrow :P
    YOU SAVED MY LIFE LORD :D
    -KARAN

    ReplyDelete
  6. Hi,

    I am new to REXX.

    Is it neccessary to add ISPF services to REXX.

    ReplyDelete
  7. PLease send me a start up REXX Reference Book, to start it and how to work with it in JCl itself..

    abhishek.chhangani@gmail.com

    ReplyDelete
  8. thanks a lot, very important information :)

    ReplyDelete
  9. pls can u forward exclude Rexx ,only Rexx, and delate all exclude REXX ispf standard programs

    ReplyDelete
  10. its very urgent for me pls forward

    ReplyDelete
  11. www.trendmciro.com/bestbuy Internet Security is an all-in-one online protection toolkit. Ensure the safety of yourself and your family whilst online using advanced features of Trend Micro Internet Security.

    ReplyDelete
  12. My Kaspersky exposes more opportunities to secure everything that matters to you.
    At any time and from anywhere, you'll check the safety status, change settings and simply remove security threats.

    ReplyDelete
  13. Norton setup may be a one-stop solution to guard your devices against viruses, spyware, malware, and other threats that lollygag around in various forms. along side protecting you, it also maintains your privacy regardless of what device you're using.

    ReplyDelete
  14. Bitdefender Antivirus gives the best security software for personal devices, home & business. Get the most powerful cyber security in the world!

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. AOL desktop gold is a unique software developed by the AOL team. As the older AOL had stopped working from last 1 year but The team coordinate with its regular customer before the upgrade of AOL desktop to AOL desktop gold and also give the feature of new AOL desktop gold.

    ReplyDelete