I've searched through the forums but did not come across a similar problem anywhere, so any help is much appreciated. I've written a new ISPF Panel (code below) where I'm trying to validate a User Input - Program Name (PGMNAME) against the list of available Programs in the Baseline. To do this, I tried calling a REXX from the ISPF Panel, IDLVALPG.
which enquires the Data Dictionary by calling a COBOL module in turn.
Panel:
Code:
)ATTR DEFAULT(%+¿)
* TYPE(PT) /* Panel Title */
% TYPE(ET) /* Emphasised Text */
+ TYPE(NT) /* Normal Text */
¿ TYPE(SI) /* Normal Text(White) */
µ TYPE(NEF) CAPS(ON) /* Normal Entry Field */
› TYPE(AB) /* Action Bar */
@ TYPE(ABSL) /* Action Bar Separator Line */
)ABC DESC('Help') MNEM(1)
PDC DESC('Print') MNEM(1)
ACTION RUN(ISRROUTE) PARM('SELECT CMD(IDLHELP 1)')
PDC DESC('Setup') MNEM(1)
ACTION RUN(ISRROUTE) PARM('SELECT CMD(IDLHELP 2)')
PDC DESC('Modify') MNEM(1)
ACTION RUN(ISRROUTE) PARM('SELECT CMD(IDLHELP 3)')
PDC DESC('Report Bug') MNEM(8) UNAVAIL(ZEDF)
)ABCINIT
.ZVARS=HELPMENU
&zedf = 1 /* Option unavailable for now */
)BODY EXPAND(\\)
› Help +
@\~\
+\ \*Panel Title+\ \
+Option ===>µZCMD
+
+
+
+\ \ ¿T E S T P A N E L + \ \
+
¿0 +Print +Option 1
¿1 +Setup +Option 2
¿2 +Modify +Option 3
+
+
+
*Enter the parameters below:
+ Program Name . . .µZ +\ \
+ Environment .µZ +\ \
+
+
+
+
+
)INIT
.ZVARS = 'PGMNAME ENVNAME'
.HELP = IDLHLPP
VGET (PGMNAME ENVNAME) PROFILE
)REINIT
REFRESH(*)
)PROC
VER (&PGMNAME,NB)
VER (&ENVNAME,NB)
&ZQ = &Z
IF (&ZCMD ^= ' ')
&ZQ = TRUNC(&ZCMD,'.')
IF (&ZQ = ' ')
.MSG = IDMSG001
&ZSEL = TRANS( &ZQ
0,'CMD(OPTONE)'
1,'CMD(OPTTWO)'
2,'CMD(OPTTHREE)'
' ',' '
*,'?')
&ZTRAIL = .TRAIL
VPUT (PGMNAME ENVNAME) PROFILE
&CPOS = ZCMD
*REXX(*,PGMNAME,(IDLVALPG))
IF (.MSG ^= &Z)
EXIT
*REXX(*,CPOS,PGMNAME,ENVNAME)
/*
prefix = substr(PGMNAME,1,2)
if prefix ^= 'EP' then
do
cpos = 'PGMNAME'
zrxmsg = 'IDMSG002'
zrxrc = 8
return
end
*/
*ENDREXX
IF (.MSG ^= &Z)
.CURSOR = &CPOS
REFRESH(*)
ELSE
.CURSOR = ZCMD
)END
IDLVALPG :
Code:
/********************************************************/
/* Call ISPPRXVP to get the ISPF dialog variables into */
/* REXX. */
/********************************************************/
Call ISPPRXVP 'I'
/********************************************************/
trace ?i
say PGMNAME
RETCODE1 = '0000'
INPUTA = 'PGM'||PGMNAME
address tso "CALL BASELINE.COBOL(DDENQ)' '/TEST'"
if RETCODE1 ^= '0000' then
do
say RETCODE1
end
Call ISPPRXVP 'T'
/********************************************************/
/* Call ISPPRXVP to get update the ISPF dialog */
/* variables with the changes made in this REXX. */
/********************************************************/
Call ISPPRXVP 'T'
Return
The following COBOL snippet fetches the value of the REXX variable 'INPUTA' using IRXEXCOM
...
MOVE 0 TO NILVALUE
MOVE 'INPUTA' TO REXXVARNAME
MOVE 6 TO REXXVARNAMEL
SET SHVNAMA TO ADDRESS OF REXXVARNAME
MOVE REXXVARNAMEL TO SHVNAML
SET SHVVALA TO ADDRESS OF REXXVARVALUE
MOVE 0 TO SHVNEXT
MOVE 0 TO SHVUSER
MOVE 'F' TO SHVCODE
MOVE X'00' TO SHVRET
MOVE X'0000' TO X
CALL IRXEXCOM USING IRXEXCOM NIL NIL SHVBLOCK
MOVE REXXVARVALUE TO INPUTA
When I call IDLVALPG from the Panel, IRXEXCOM always returns a value of X'01' for SHVRET, which the manual suggests is the code for SHVNEWV EQU X’01’ - Variable did not exist.
However, if I instead use IDLVALPG as a REXX by itself, the call is successful with SHVRET X'00'.
How do I get around this? Is what I'm trying to achieve actually possible?
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
Sorry, I am not a COBOLer, so I might be wrong.
I would start with the COBOL program and have it do some VDEFINEs and then display the panel. After the display, field value should be in the vdefined variable.
I assume that the 'say pgmname' in IDLVALPG shows the correct value?
Can't say why it does not work, but I have a suggestion. Since IDLVALPG is so small, move it's code to the inline REXX in the panel.
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
It probably has something to do with how the Rexx environment is established by the *Rexx panel statement. (This is only an educated guess on my part. I have learned from other experiences with panel exits and inline Rexx that sometimes there are unexpected restrictions. For example, I once had a Rexx panel exit that performed a DB2 call via DSNREXX. It worked well for years, until we went to z/OS 2.1)
If you only have one variable to pass to the Cobol program, you could always pass it as a PARM rather than attempt to retrieve it via IRXEXCOM. Which does not explain why it is not working, however.
@Pedro - The COBOL program is an existing module which is used for Cross-Reference elsewhere as well so I won't be able to modify it. Making a copy of it doesn't make sense for just one Panel so I'll have to abandon the idea, if I can't get this to work, unfortunately.
@Wily - The 'say' statement does show the correct value, which means that IDLVALPG does have access to PGMNAME from the ISPF Panel. Strangely enough the REXX variable, INPUTA goes missing when IRXEXCOM tries to access it (And I don't know how it tries to do so - Couldn't find anything relevant so far). Incidentally, I had started with inline REXX but thought I could try moving it out of the ISPF panel, just in case the variable defined in the Panel was not accessible to IRXEXCOM. Evidently that didn't work either!
I've just started with System Programming and incidentally this is the first ISPF Application that I have written, so I'm obviously lacking in experience. I've been able to work my way around using the (excellent) IBM manuals, but apart from that I'm pretty much on my own
I looked up troubleshooting tips from SHARE conferences, tried using 'say' statements, Panel Trace ISPDPTRC, ISPVCALL MONITOR VAR(INPUTA) and the /TEST option with the call statement, but nothing has helped me so far.
The call to the COBOL module works as expected if I do it from a standalone REXX, but not from the Panel REXX. No idea why!
I have done a test with an assembler program which does get/put using IRXEXCOM, and it works fine - except that the panel variable 'pgmstat' is not set afterwards.
Panel snippet:
%Enter programname#pgmname +
+
%Is ok ? ¤pgmstat +
+
)Init
&pgmname = &Z
&pgmstat = &Z
)Proc
*REXX(*,(TESTPX02))
Appreciate your help. I've XMIT'ed your XMI file from CBTTAPE but unfortunately I won't be able to use it in our environment because it is written in Assembly and I cannot use it without being able to explain how it does, what it does I've never used ASM on the ZOS so far.
Is there anything else I could try that could possibly lead a way out? Thanks again for looking into this.
I can only assume it has to do with the way the COBOL program initializes the REXX environment. I'm not a COBOL person so can't help you there. However, if it sets the RETCODE1 variable, then it must have a valid REXX environment.
By the way, you do not need the "Call ISPPRXVP 'I'" , "Call ISPPRXVP 'T'" and "RETURN" statements, they are inserted for you.
The $$DOC member in the CBT669 file tells you what the program does, but that of course might not be enough.
There is a difference to how you use your COBOL program - REXXGBLV must run as a function.
Sorry, I am out of ideas.