I am trying to generate a panel on-the-fly, allocate a panel library, write the member to the library and LIBDEF it to ISPPLIB. When I issue the call to DISPLAY PANEL() service, it sets a return-code of 20. I am unable to understand, why the DISPLAY is failing. I tried searching on the Internet, but couldn't get much help. Could you give me some pointers, about what's wrong?
/*__________________________________________________________________*/
Display_Dyn_Panel:
/* ----------------- */
/* This routine builds an ISPF Panel on the fly and displays it. */
/*__________________________________________________________________*/
ZPF07 = 'PREV'
ZPF08 = 'NEXT'
ZCMD = ''
ROW = 0
COL = 0
Call load_dynlib
Call put_object
Address ispexec "libdef ispplib library id("dynlib") stack"
SAY 'LIBDEF RC = ' RC
Address Ispexec "VPUT (ZPF07,ZPF08) PROFILE"
/* Say 'VPUT RC: ' RC */
Address Ispexec "ADDPOP ROW(05) COLUMN(01)"
IF RC > 0 THEN DO
Say 'ADDPOP RC = ' RC
EXIT
end
Address Ispexec "DISPLAY PANEL(DYNPANE)"
Display_rc = rc
IF DISPLAY_RC > 0 THEN DO
SAY 'DISPLAY PANEL RC = ' RC
EXIT
END
Address ISPEXEC "REMPOP"
/* SAY 'DISPLAY_RC : ' DISPLAY_RC */
RETURN
/*__________________________________________________________________*/
load_dynlib:
/* ----------------- */
/* This routine queues the panel body, and then stores it in a mem. */
/*__________________________________________________________________*/
dynlib = 'dyn'||random(99999)
tempds = USERID()|| '.ISPPLIB.TMP' ||random(9999)
alloc_fi = "ALLOC FI ("dynlib") da('"tempds"')" ||,
" lrecl(80) blksize(800)" ||,
" new reu" ||,
" space(5,5) dir(10) "
ADDRESS TSO ""alloc_fi""
if rc = 0 then do
ispdyn = tempds
end
else do
ispdyn = 'NOT FOUND'
Say 'Failed to allocated Dynamic Library'
Say '//' || dynlib || ' DD DSN=' || tempds
Say rc
exit
end
Address tso
"newstack"
member = 'DYNPANE'
queue ')ATTR'
queue '@ AREA(DYNAMIC) SCROLL(OFF)'
queue 'Y TYPE(CHAR) COLOR(TURQUOISE) HILITE(REVERSE)'
queue '~ TYPE(CHAR) COLOR(GREEN)'
queue '$ TYPE(DATAIN) COLOR(TURQUOISE) HILITE(REVERSE)'
queue '_ TYPE(NEF) PADC(_)'
queue '| TYPE(TEXT) COLOR(YELLOW)'
queue 'ยข TYPE(DATAOUT) COLOR(BLUE)'
queue '? TYPE(NT)'
queue ')BODY WINDOW(76,12) CMD(ZCMD)'
queue '| MINE - Structure Chart Generator' ||,
' +'
queue '? ' ||,
' +'
queue '+@DYNVAR,SHADVAR ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue ')PROC'
queue '&PFKEY=.PFKEY'
queue ')END'
RETURN
/*__________________________________________________________________*/
put_object:
/* ---------- */
/* This routine stores the member into the Temporary ISPF Library */
/* allocated previously. */
/*__________________________________________________________________*/
tfil = 'tfil' || random(9999)
Address tso
"alloc f("tfill") da('"ispdyn"("member")') shr reu"
if rc > 0 then do
say 'Failed to allocate member, RC = ' rc
end
Address tso
"execio" queued() "diskw "tfill" (finis"
"free f("tfill")"
"delstack"
RETURN
Display_Dyn_Panel:
/* ----------------- */
/* This routine builds an ISPF Panel on the fly and displays it. */
/*__________________________________________________________________*/
ZPF07 = 'PREV'
ZPF08 = 'NEXT'
ZCMD = ''
ROW = 0
COL = 0
Call load_dynlib
Call put_object
Address ispexec "libdef ispplib library id("dynlib") stack"
SAY 'LIBDEF RC = ' RC
Address Ispexec "VPUT (ZPF07,ZPF08) PROFILE"
/* Say 'VPUT RC: ' RC */
Address Ispexec "ADDPOP ROW(05) COLUMN(01)"
IF RC > 0 THEN DO
Say 'ADDPOP RC = ' RC
EXIT
end
Address Ispexec "DISPLAY PANEL(DYNPANE)"
Display_rc = rc
IF DISPLAY_RC > 0 THEN DO
SAY 'DISPLAY PANEL RC = ' RC
EXIT
END
Address ISPEXEC "REMPOP"
/* SAY 'DISPLAY_RC : ' DISPLAY_RC */
RETURN
/*__________________________________________________________________*/
load_dynlib:
/* ----------------- */
/* This routine queues the panel body, and then stores it in a mem. */
/*__________________________________________________________________*/
dynlib = 'dyn'||random(99999)
tempds = USERID()|| '.ISPPLIB.TMP' ||random(9999)
alloc_fi = "ALLOC FI ("dynlib") da('"tempds"')" ||,
" lrecl(80) blksize(800)" ||,
" new reu" ||,
" space(5,5) dir(10) "
ADDRESS TSO ""alloc_fi""
if rc = 0 then do
ispdyn = tempds
end
else do
ispdyn = 'NOT FOUND'
Say 'Failed to allocated Dynamic Library'
Say '//' || dynlib || ' DD DSN=' || tempds
Say rc
exit
end
Address tso
"newstack"
member = 'DYNPANE'
queue ')ATTR'
queue '@ AREA(DYNAMIC) SCROLL(OFF)'
queue 'Y TYPE(CHAR) COLOR(TURQUOISE) HILITE(REVERSE)'
queue '~ TYPE(CHAR) COLOR(GREEN)'
queue '$ TYPE(DATAIN) COLOR(TURQUOISE) HILITE(REVERSE)'
queue '_ TYPE(NEF) PADC(_)'
queue '| TYPE(TEXT) COLOR(YELLOW)'
queue 'ยข TYPE(DATAOUT) COLOR(BLUE)'
queue '? TYPE(NT)'
queue ')BODY WINDOW(76,12) CMD(ZCMD)'
queue '| MINE - Structure Chart Generator' ||,
' +'
queue '? ' ||,
' +'
queue '+@DYNVAR,SHADVAR ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue '+@ ' ||,
' @'
queue ')PROC'
queue '&PFKEY=.PFKEY'
queue ')END'
RETURN
/*__________________________________________________________________*/
put_object:
/* ---------- */
/* This routine stores the member into the Temporary ISPF Library */
/* allocated previously. */
/*__________________________________________________________________*/
tfil = 'tfil' || random(9999)
Address tso
"alloc f("tfill") da('"ispdyn"("member")') shr reu"
if rc > 0 then do
say 'Failed to allocate member, RC = ' rc
end
Address tso
"execio" queued() "diskw "tfill" (finis"
"free f("tfill")"
"delstack"
RETURN