Not able to trap the command entered on the Panel in Rexx



IBM's Command List programming language & Restructured Extended Executor

Not able to trap the command entered on the Panel in Rexx

Postby Quasar » Sun Aug 12, 2012 10:10 am

Dear friends,

I am making a small tool on my project, to unload DB2 Tables in an MS Excel File Format. The tables to be unloaded are displayed in an ISPF Panel called UNLDPAN2.

Image

This panel contains a dynamic area with SCROLL=ON. I would like to handle the scrolling, through my Rexx Driver Program. I am trying to trap the command entered by the user on this screen. However, I do not get any values in the ZCMD Variable. Kindly let me know, how I can trap the value entered in the command-line area.

In the Rexx paragraph DISPLAY_FILTER_CRITERIA, I DISPLAY PANEL(UNLDPAN2), followed by which I VGET(ZCMD,SCRVAR) Variables. However, I still find ZCMD = ' '.

Rexx Source Code
/* REXX - Fast Unload Utility                                */
/*                                                           */
/* Author : Quasar Chunawala quasar.chunawala@igate.com      */
/*                                                           */
/* REXX PROGRAM - FASTUNLD                                   */
/* PANELS       - UNLDPAN1,UNLDPAN2                          */
/*                                                           */
/* VERSION 1.0                                               */
/* UNLOADS DB2 TABLES FROM PRODUCTION INTO SYSREC DATASETS   */
/*     (c) Copyright iGate Computers., 2012                  */

/****/
MAIN:
/****/

   CALL READ_KEY_COLS

   CALL DISPLAY_FILTER_CRITERIA

   /*ADDRESS ISPEXEC
   "VGET (ZCMD)" */


   EXIT

READ_KEY_COLS:
   ADDRESS TSO
   "ALLOC F(KEYDD) SHR DS('SYSADM.KEY.COLUMN.LIST')"
   "EXECIO * DISKR KEYDD (FINIS STEM KEYDS."

   RETURN

DISPLAY_FILTER_CRITERIA:
   darea = ''
   OLD_TNAME = ''
   SCRVAR = 'CSR'

   DO I = 2 TO KEYDS.0
      PARSE VAR KEYDS.I CREATOR TNAME COLUMN DATA_TYPE
      DATA_TYPE = STRIP(DATA_TYPE)

      IF TNAME <> OLD_TNAME THEN DO
         CALL PUT_BLANK_LINE
         CALL PUT_TBL_NAME
         CALL PUT_BLANK_LINE
         CALL PUT_HEADER
         OLD_TNAME = TNAME
      END

      CALL PUT_DATALINE

   END

/* CALL put_tbl_name
   CALL put_blank_line
   CALL put_header
   CALL put_dataline
   CALL put_dataline
   CALL put_dataline
   CALL put_dataline
   CALL put_dataline */

ADDRESS ISPEXEC
"DISPLAY PANEL(UNLDPAN2)"

ADDRESS ISPEXEC
"VGET (ZCMD SCRVAR)"
SAY 'COMMAND : ' ZCMD ' SCRVAR = ' SCRVAR

RETURN

put_tbl_name:
   pad_right = copies(' ',12)
   CREATOR = CREATOR || COPIES(' ',9 - LENGTH(CREATOR))
   TNAME   = TNAME   || COPIES(' ',19 - LENGTH(TNAME))
   tbl_name= ' CREATOR ==> _' || CREATOR || '@'
   tbl_name= tbl_name || '        TABLE ==> _' || TNAME || '@',
   || pad_right

   darea = darea || tbl_name
   RETURN

put_blank_line:
   blank_line = copies(' ',76)

   darea = darea || blank_line
   RETURN

put_header:
   Hrpad = copies(' ',39)
   header ='  DATA-TYPE   COLUMN             WHERE' || Hrpad

   darea = darea || header
   RETURN

put_dataline:
   Drpad = copies(' ',21)
   DATA_TYPE = DATA_TYPE || COPIES(' ',11 - LENGTH(DATA_TYPE))
   COLUMN = COLUMN || COPIES(' ',18 - LENGTH(COLUMN))
   dataline ='_' || DATA_TYPE
   dataline = dataline || '_' || COLUMN
   dataline = dataline || '_                      @' || Drpad

   darea = darea || dataline

   RETURN


Panel DTL Source Code
<!DOCTYPE DM SYSTEM>                                           
<PANEL NAME=UNLDPAN2> DB2 UNLOAD UTILITY                       
<TOPINST> Enter the filter criteria                             
<AREA>                                                         
   <DA NAME=DAREA DIV=SOLID DEPTH=13 EXTEND=ON SHADOW=shadwvar 
       SCROLL=ON SCROLLTAB=YES SCRCAPS=ON SCROLLVAR=scrvar>     
       <ATTR ATTRCHAR=# TYPE=CHAR COLOR=RED>                   
       <ATTR ATTRCHAR=% TYPE=CHAR COLOR=GREEN>                 
       <ATTR ATTRCHAR=_ TYPE=DATAIN COLOR=TURQ PADC='_'>       
       <ATTR ATTRCHAR=@ TYPE=DATAOUT COLOR=BLUE>               
       <ATTR ATTRCHAR=! TYPE=CHAR COLOR=YELLOW HILITE=REVERSE> 
   </DA>                                                       
</AREA>                                                         
<CMDAREA> Enter a command                                       
</PANEL>                                                       


Compiled Panel Source Code
)PANEL                                                                 
)ATTR DEFAULT(   ) FORMAT(MIX)            /* UNLDPAN2 - ENGLISH - 5.2 */
 05 TYPE(PT)                                                           
 06 TYPE(PIN)                                                           
 09 TYPE(FP)                                                           
 0A TYPE(NT)                                                           
 0C TYPE(NT) SKIP(ON)                                                   
 13 TYPE(NEF)                                                           
 22 TYPE(WASL) SKIP(ON) GE(ON)                                         
 26 AREA(DYNAMIC) EXTEND(ON) SCROLL(ON)                                 
 #  TYPE(CHAR) COLOR(RED)                                               
 %  TYPE(CHAR) COLOR(GREEN)                                             
 _  TYPE(DATAIN) PADC('_') COLOR(TURQ)                                 
 @  TYPE(DATAOUT) COLOR(BLUE)                                           
 !  TYPE(CHAR) COLOR(YELLOW) HILITE(REVERSE)                           
 27 TYPE(NEF) CAPS(ON)                                                 
)BODY WINDOW(76,22) CMD(ZCMD)                                           
                             DB2 UNLOAD UTILITY                         
Enter a command ===> Z                                   Scroll ===> Z
                                                                     
Enter the filter criteria                                             
                                                                     
----------------------------------------------------------------------
DAREA,SHADWVAR                                                       
                                                                     
                                                                     
                                                                     
                                                                     
                                                                     
                                                                     
                                                                     
                                                                     
                                                                     
                                                                     
                                                                     
                                                                     
 -----------------------------------------------------------------------
)INIT                                                                   
.ZVARS = '(ZCMD SCRVAR)'                                               
&ZCMD = ' '                                                             
)PROC                                                                   
)END                                                                   
/* ISPDTLC Release: 5.2.  Level: OW55303, PTF: UW92472                */
/* z/OS 01.02.00.  Created - Date: 12 Aug 2012, Time: 02:59           */
Quasar Chunawala,
Software Engineer, Lives at Borivali, Mumbai
User avatar
Quasar
 
Posts: 102
Joined: Wed Nov 10, 2010 7:11 pm
Location: Borivali, Mumbai
Has thanked: 13 times
Been thanked: 2 times

Re: Not able to trap the command entered on the Panel in Rex

Postby Pedro » Sun Aug 12, 2012 11:02 am

Remove the VGET. Rexx and ISPF are pretty well integrated... they understand each other's variables.
Pedro Vera

These users thanked the author Pedro for the post:
Ed Goodman (Wed Aug 15, 2012 5:44 pm)
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: Not able to trap the command entered on the Panel in Rex

Postby Quasar » Sun Aug 12, 2012 11:13 am

Hi Pedro,

I have tried doing that as well, but in vain. I am able to get the value SCRVAR = CSR, but I still get the value of ZCMD as ' '.
Quasar Chunawala,
Software Engineer, Lives at Borivali, Mumbai
User avatar
Quasar
 
Posts: 102
Joined: Wed Nov 10, 2010 7:11 pm
Location: Borivali, Mumbai
Has thanked: 13 times
Been thanked: 2 times

Re: Not able to trap the command entered on the Panel in Rex

Postby mongan » Mon Aug 13, 2012 11:41 am

Are you sure that you did not VGET the zcmd which would destroy the value that is actually in the zcmd?

These users thanked the author mongan for the post (total 2):
Quasar (Sat Aug 18, 2012 11:36 am) • Ed Goodman (Wed Aug 15, 2012 5:44 pm)
User avatar
mongan
 
Posts: 211
Joined: Tue Jan 11, 2011 8:32 pm
Has thanked: 1 time
Been thanked: 5 times

Re: Not able to trap the command entered on the Panel in Rex

Postby Quasar » Wed Aug 15, 2012 10:32 am

Thanks everybody, on removing the VGET it is working now.
Quasar Chunawala,
Software Engineer, Lives at Borivali, Mumbai
User avatar
Quasar
 
Posts: 102
Joined: Wed Nov 10, 2010 7:11 pm
Location: Borivali, Mumbai
Has thanked: 13 times
Been thanked: 2 times

Re: Not able to trap the command entered on the Panel in Rex

Postby Ed Goodman » Wed Aug 15, 2012 5:44 pm

This was a good thread!
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post