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