Friday, November 11, 2011

Design ISPF panel for REXX tool

Designing a REXX tool with panel is not a tough task. You just need to learn to design ISPF panel and display panel from REXX code and you might also need to know how to use skeleton JCL and submit a job from REXX program.  So to design your REXX tool with panel you need to know following things.


1. How to create an ISPF panel ( Many of us call it REXX panel )?
2. How to get data from panel and pass to the REXX program ?
3. How to display ISPF panel from REXX program ?
4. How to use a skeleton JCL ?
5. How to submit a job from REXX ?

I have cited here a simple example of a REXX tool with ISPF panel. This tool copies tape dataset to DASD. This will give overview for creating a REXX tool using ISPF panel and you can create your own REXX tool using this example as base.


Entire tool needs four input files and one output file ( PDS member ).

1. Panel : This will contain the panel definition. This is where you need to define your panel. You can define input fields, text to be displayed, field color etc.

2. Error Messages : This will contain the error messages which you want to display in the ISPF panel when user enters invalid or unwanted inputs.

3. REXX Program : This is executable REXX program which will display the panel and process the inputs.

4. Skeleton JCL : Most cases we need to submit a batch job to process inputs and get desired results. The skeleton JCL will contain the main structure and the REXX program will create a run JCLs using this skeleton JCL with appropriate parameter.

5. Output JCL :  This is the output JCL which will be created by the REXX program and will be used to submit the job.

In my example tool I have kept the panel,  error msg and REXX program in a single PDS and skeleton JCL and output JCL in two other PDS. I prefer to keep the output JCL and skeleton JCL in different PDS  to avoid accidental update of the skeleton JCL.

Now lets see how you can run this REXX tool by implementing it yourself.

Step 1. Create a PDS with record length 80. Let's say the name is : N1234A.REXX.TOOL

Step 2. Create three members ( Please use the same name as given here ): TP2DDPL, TAPE2DSD, PRD00.

TP2DDPL will contain the panel definition.
TAPE2DSD is the REXX program.
PRD00 will contain error messages to be shown in the panel.


Find the content of the panel definition here.
Find REXX code here.
And here is the content to be put in PRD00.

Step 3.  Create a PDS for skeleton JCL named : N1234A.REXX.SKELL. Create a member named TP2DDJCL.

Here is the skeleton JCL body.

Step4. Create an empty PDS named 'N1234A.SUB.JCL'. This is where the output JCL will be created and the REXX code will submit this job.

You are all set. You can run your tool by executing the REXX program.

Please post your questions if you have any. Happy programming !!


17 comments:

  1. Great post..this really helps. I was looking for similar example.

    ReplyDelete
  2. thanks for creating such post on mainframe.its really helpful.

    ReplyDelete
  3. When i am displaying the panel, i am getting Return Code - 20, like below.

    13 *-* 'DISPLAY PANEL(TP2DDPL) MSG(&ERMSG)'
    >>> "DISPLAY PANEL(TP2DDPL) MSG(&ERMSG)"
    +++ RC(20) +++

    Please help me in displaying the Panel.

    ReplyDelete
    Replies
    1. Are you using the ISPPLIB and ISPMLIB correctly ? Please make sure you are using correct name as well. The given code is working without any issue. Please copy paste the code and use without any changes except your PDS name.

      you can also check below link for return code 20

      http://www.tek-tips.com/viewthread.cfm?qid=976992

      Delete
  4. When I execute the REXX program it ends with a RC = 0...There is no display of the panel. I executed the rexx program by typing 'ex' infornt of TAPE2DSD member.Please suggest.

    ReplyDelete
    Replies
    1. Please make sure you are calling the panel properly from the program. Did you change the code to point to your own PDS ? you need to do that.

      Delete
  5. I am fairly new to the REXX programming. This is an excellent code. Even I am not able to see the Panel when I execute the REXX Program. I do a TSO EXEC 'PDS Name(TAPE2DSD)'. I have made sure the ispplib and ispmlib are correct. Please suggest

    ReplyDelete
    Replies
    1. I figured out how to display the panel. In the display member name- TP2DDPL we have the line nos from 72 thru 80. Do a num off and delete the line nos. It should work !!

      Delete
  6. Great post.. please post screen shots of how the panel look like.

    ReplyDelete
  7. I am getting below error:
    IKJ56532I STMT 20 - LABEL START SPECIFIED BUT COMMAND NOT FOUND
    IKJ56532I STMT 48 - LABEL CVTUPPER SPECIFIED BUT COMMAND NOT FOUND
    ***

    ReplyDelete
    Replies
    1. START is the main function and CVTUPPER is called function ..somehow your code is not recognizing those as function level...did you copy paste the code properly ? Please make sure you have the colon after the name of the function

      Delete
    2. This comment has been removed by the author.

      Delete
  8. hi ,
    Its submiting blank subjcl file.

    ReplyDelete
    Replies
    1. I recently tested the code ..it is working fine...please ensure to num off before copy pasting the components and change all PDS according to your PDS names inside the rexx code.. the JCL has a empty line by mistake...remove that..it will work like a cham

      Delete
  9. I recently tested the code ..it is working fine...please ensure to num off before copy pasting the components and change all PDS according to your PDS names inside the rexx code.. the JCL has a empty line by mistake...remove that..it will work like a cham

    ReplyDelete
  10. Hello All,

    The link to the rexx panel, rexx code etc is no longer valid ?

    ReplyDelete