× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



At some point, actual examples are just *way* better than just words trying to explain. Except it helps when I do not hit send both before finding that my crappy copy\paste caused me to lose a line of code [i.e. a GOTO postLIB went missing] and before adding a couple a /words/ :-) to help explain a couple very important lines of source.

The source in the CL stream for the GETENVRCPP has a second MONMSG in parmLIB processing. If the retrieve request in the parmLIB processing fails due to an error before it tries to set the return value into &LIB, then the MCH3601 will not have occurred, so further processing could still encounter the MCH3601.

I do not recall, but I think the most common way utilized to more conspicuously force the MCH3601 error before any processing, is to have the first request for each parm### processing issue the request CHGVAR &RTNVAR### &RTNVAR### just as Vern had noted in an earlier reply. Doing that is probably much *safer and clearer* than my reliance on the RTVxxxx requests to effect the MCH3601...

Thus in parmLIB processing for the GETENVRCPP source, the first command with the MCH3601 monitor would be CHGVAR &LIB &LIB. The MONMSG for the MCH3601 would move to just after that CHGVAR, and after the message is removed in the handler for the MCH3601, the GOTO sends further processing to the postLIB label. I did *not* make these changes inline below!

A line to GETENVRCPP was added in source inline below. Some lines were also added to GETENVRTST as recommended as well.

Regards, Chuck

On 12 Apr 2013 15:38, CRPence wrote:
On 12 Apr 2013 14:11, Stone, Joel wrote:
<<SNIP>> Is it possible to make a return variable optional?

//bchjob jobd(one_with_a_user) job(getenvrtst)
//DATA GETENVR *SRC
CMD
PARM KWD(SYS) TYPE(*CHAR) LEN(10) MIN(0) MAX(1) RTNVAL(*YES)
PARM KWD(LIB) TYPE(*CHAR) LEN(10) MIN(0) MAX(1) RTNVAL(*YES)
//
//DATA GETENVRCPP
pgm parm(&sys &lib)
dcl &sys *char 10
dcl &lib *char 10

parmSYS:
rtvneta sysname(&sys)
monmsg mch3601 exec(do)
rcvmsg (*same (*)) *pgmq *excp *n 0 rmv(*yes)
goto postSYS
enddo
postSYS:

parmLIB:
rtvobjd *libl/prodfile *file rtnlib(&lib)
monmsg mch3601 exec(do)
rcvmsg (*same (*)) *pgmq *excp *n 0 rmv(*yes)
goto postLIB
enddo
monmsg (cpf9800) exec(chgvar &lib '*NOPROD')
/* maybe rmv or mov the error message */
postLIB:
return
//
//DATA GETENVRTST
dcl &ij *char 01
dcl &sysname *char 10
dcl &libname *char 10
rtvjoba type(&ij)
chgvar &sysname 'junk'
chgvar &libname 'junk'
getenvr &sysname &libname
dmpclpgm
if (&ij *eq '1') then(do)
dspsplf qppgmdmp splnbr(*last)
dltsplf qppgmdmp splnbr(*last)
enddo

chgvar &sysname 'junk'
chgvar &libname 'junk'
getenvr () &libname
dmpclpgm
if (&ij *eq '1') then(d0)
dspsplf qppgmdmp splnbr(*last)
dltsplf qppgmdmp splnbr(*last)
enddo

/* to be more thorough, add the following test */
chgvar &sysname 'junk'
chgvar &libname 'junk'
getenvr &libname ()
dmpclpgm
if (&ij *eq '1') then(d0)
dspsplf qppgmdmp splnbr(*last)
dltsplf qppgmdmp splnbr(*last)
enddo

//
crtclpgm getenvr srcfile(getenvrcpp)
crtcmd getenvr getenvr srcfile(getenvr) allow(*ipgm *bpgm *irexx *brexx)
crtclpgm getenvrtst srcfile(getenvrtst)
chgjob logclpgm(*yes)
call getenvrtst
dspjoblog output(*print)
//endbchjob


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.