z/OS - Group home

Did you know ISPF lets you embed panels and messages in a Rexx exec?

  

If you want to deploy an ISPF Rexx dialog, but don't want to ship the panels and messages as separate libraries, here is a technique that allows you to package the entire dialog in a single exec.

 

This exec shows a method of embedding panels and messages right in an exec, so that you don't have to ship a separate panel or message library. The exec is a bit long, but well worth looking at.

The general design is to

  • allocate a temporary PDS
  • for each panel and message member, scan the rexx for /*PANEL panname, and put the lines between the /*PANEL statement and the next */ into member panname of the PDS
  • LIBDEF the PDS to both ISPPLIB and ISPMLIB
  • execute the dialog statements
  • free the LIBDEFs
  • free the PDS
/*************************************************************REXX***/ /*REXX Edit macro showing how to create a panel, display it, and    */ /*     use input from that panel.  This makes it possible to        */ /*     ship an exec with panels embedded in the exec file.          */ /*     This example also includes embedded messages.                */ /*                                                                  */ /*     Panels and messages are embedded at the end of the exec as   */ /*     comments.                                                    */ /*     The comments are of the form:                                */ /*         /+PANEL panelname or messagename                         */ /*             panel or message definition                          */ /*         +/                                                       */ /*      where /+ and +/ are really REXX comment delimiters in col 1 */ /*                                                                  */ /*     Although this is shown as an edit macro, the method used     */ /*     is not dependent on any edit macro facilities.               */ /*                                                                  */ /*     The method used is:                                          */ /*      1) Create a temporary panel library                         */ /*      2) use LIBDEF to point to the new panel/message library.    */  /*      3) Display the panel, which will set some variables.        */  /*      4) Use LIBDEF again to clean up.                            */  /********************************************************************/                                                                                                                                                  Address 'ISPEXEC'                                                       'ISREDIT MACRO (DSN)'                                                   Parse Source system . cmdname .                                         Call createlib                                                          'ISREDIT LINE_BEFORE .ZFIRST = (LINE3)'                                 'ISREDIT LINE_BEFORE .ZFIRST = (LINE2)'                                 'ISREDIT LINE_BEFORE .ZFIRST = (LINE1)'                                 'ISREDIT LOCATE .ZFIRST'                                                Exit 1                                                                                                                                          /**** createlib: Create and display a temporary panel ***************/                                                                          createlib:                                                              exec_line=1   /* Start looking for embeds at line 1 of the exec */     /* allocate a temporary data set                                    */    Address tso 'ALLOC NEW CAT F($TMPLIB$) DSO(PO) DIR(1) SP(3,3) TRACK                 da($WWWSAMP.TEMP.ISPFLIB) REUSE                                         RECFM(F B) BLKSIZE(0) LRECL(80) UNIT(SYSALLDA)'           Call make_member   /* call make_member once for each embedded member*/  Call make_member                                                        Call make_member                                                                                                                                Address tso 'ALLOC F($TMPLIB$) OLD DA($WWWSAMP.TEMP.ISPFLIB) REUSE'                                                            'LIBDEF ISPPLIB LIBRARY ID($TMPLIB$) STACK'                             'LIBDEF ISPMLIB LIBRARY ID($TMPLIB$) STACK'                             'ADDPOP'                                                                Do Until rc>0                                                             'DISPLAY PANEL(TEMPPAN)'                                              End                                                                     'REMPOP'                                                                'LIBDEF ISPPLIB '                                                       'LIBDEF ISPMLIB '                                                       Address tso 'FREE F($TMPLIB$) DELETE'                                                                                                         Do queued();Pull;End                                                    Return                                                                                                                                          /* make_member: scan this exec for embedded parts and add to temporary*//*              library using EXECIO for I/O operations.              */make_member:                                                                                                                                    Do queued();Pull;End                                                    Do Until substr(line,1,7)='/*PANEL'                                       line = sourceline(exec_line)                                            exec_line=exec_line+1                                                 End                                                                     Parse Var line . panelname .                                            Do until substr(line,1,2)='*/'                                            line = sourceline(exec_line)                                            if substr(line,1,2) <> '*/' then                                          Queue line                                                            exec_line=exec_line+1                                                 End                                                                    pands='$WWWSAMP.TEMP.ISPFLIB('panelname')'                          Address tso 'ALLOC OLD F($TMPLIB$) DSO(PO) DIR(1) SP(3,3) TRACK                 da('pands') RECFM(F B) BLKSIZE(0) LRECL(80) REUSE                   UNIT(SYSALLDA)'                                        Address 'TSO' 'EXECIO 'queued()' DISKW $TMPLIB$ ( FINIS'            Do queued();Pull;End                                                    Return                                                                                                                                                                                                                  /*PANEL TEMPPAN                                                         )BODY WINDOW(73,12) CMD(ZCMD)                                           %Command ===>_ZCMD                                                   %                                                                          + This is a sample temporary panel defined in the &cmdname exec file.                                                                           + Enter data for line 1%===>_line1                                   +  + Enter data for line 2%===>_line2                                   +  + Enter data for line 3%===>_line3                                   +                                                                          +Enter%HELP+on the command line to show a temporary help panel.         +Enter or press%END+to leave this panel.                                )INIT                                                                     .HELP = TEMPPANT                                                        .MSG  = TEMP001                                                      )END                                                  */                                                    /*PANEL TEMPPANT                                      )BODY WINDOW(35,5) CMD()                              %                                                     + This is a%temporary+help panel.                     )END                                                  */                                                    /*PANEL TEMP00                                        TEMP001 'Here is a message'                           'This is a temporary message from the exec'           */