|
"Hewitt, Rory" wrote: > > Mohammad, > > >>Can we check number of incoming parameters in CLLE? Just like RPGLE? > > Not directly - there is no equivalent to the %parms built-in-function. > However, there may be an MI eqivalent. Another option is to attempt to do > something with each parameter and MONMSG for the relevant MCH* error > (MCH3601? I can't remember)... > Danger, danger. You don't always get an exception if you reference an unpassed CLLE parameter. Here's an experiment. Don't try it. (I changed the RPG program a bit, so it won't compile.) /* CLLE */ PGM PARM(&p2passed &p2) DCL &p2passed type(*lgl) DCL &p2 type(*char) len(10) DCL &test type(*char) len(10) chgvar &p2passed '1' chgvar &test &p2 monmsg mch0000 exec(do) chgvar &p2passed '0' enddo if (&p2passed = '1') then(chgvar &p2 'new p2 val') RETURN * RPGLE D clle pr D p2passed n D p2 10a options(*nopass) D fld s 10a D p2passed s n * No, no, no, don't fix this so it will compile. * You DO NOT want to run this D save s 60a dim(3) C eval fld = 'rpg 1' C callp clle (p2passed) C eval save(1) = p2passed + ' ' + fld C eval fld = 'rpg 2' C callp clle (p2passed : fld) C eval save(2) = p2passed + ' ' + fld C eval fld = 'rpg 3' C callp clle (p2passed) C eval save(3) = p2passed + ' ' + fld C 'after 1st' dsply save(1) C 'after 2nd' dsply save(2) C 'after 3rd' dsply save(3) C eval *inlr = '1' Expected results DSPLY after 1st 0 rpg 1 DSPLY after 2nd 1 new p2 val DSPLY after 3rd 0 rpg 3 Actual results: DSPLY after 1st 1 rpg 1 DSPLY after 2nd 1 new p2 val DSPLY after 3rd 1 new p2 val The RPG program calls the CL 3 times, only passing a parameter on the second call. The CL procedure behaved as though it was passed a parameter all three times. I expected to have the first call "work", but the CLLE procedure got a parameter even for that call. I have no idea what it updated when it set the parameter to "new p2 val". The third call behaved as I expected, with the parameter passed in the second call still being available on the third call even though it wasn't actually passed. Don't try this at home, "professional driver on closed course" etc. Please take my word for the results.
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.