|
Thanks for the Responses.
Command with Return Values
CMD PROMPT('TEST NULL PARMS') PARM KWD(PRM1) TYPE(*CHAR) LEN(25) RTNVAL(*YES) + PROMPT('PARM 1') PARM KWD(PRM2) TYPE(*CHAR) LEN(25) RTNVAL(*YES) + PROMPT('PARM 2') PARM KWD(PRM3) TYPE(*CHAR) LEN(25) RTNVAL(*YES) + PROMPT('PARM 3')
CPP in RPGLE -- Figure out which Parms are Null
d p0Parm1 s 25 d p0Parm2 s 25 d p0Parm3 s 25 d v1Nul1 s Like(*In01) d v1Nul2 s Like(*In01) d v1Nul3 s Like(*In01) c *Entry Plist c Parm p0Parm1 c Parm p0Parm2 c Parm p0Parm3 c* c Eval v1Nul1 = *OFF c Eval v1Nul2 = *OFF c Eval v1Nul3 = *OFF c* c If %Addr(p0Parm1) = *Null c Eval v1Nul1 = *On c Endif c* c If %Addr(p0Parm2) = *Null c Eval v1Nul2 = *On c Endif c* c If %Addr(p0Parm3) = *Null c Eval v1Nul3 = *On c Endif c* c Call 'TSTPRM2' c Parm p0Parm1 c Parm p0Parm2 c Parm p0Parm3 c Parm v1Nul1 c Parm v1Nul2 c Parm v1Nul3 c Return
CL Program TSTPRM2 -- Do assignments if Parm Not Null
PGM PARM(&P1 &P2 &P3 &B1 &B2 &B3)
DCL &P1 *CHAR 25 DCL &P2 *CHAR 25 DCL &P3 *CHAR 25 DCL &B1 *LGL DCL &B2 *LGL DCL &B3 *LGL
IF COND(*NOT &B1) THEN(CHGVAR VAR(&P1) + VALUE('PARM1'))
IF COND(*NOT &B2) THEN(CHGVAR VAR(&P2) + VALUE('PARM2'))
IF COND(*NOT &B3) THEN(CHGVAR VAR(&P3) + VALUE('PARM3'))
RETURN
ENDPGM
As an Amazon Associate we earn from qualifying purchases.
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.