|
Paul Morgan wrote: > > Is this requirement to check %Parm more to do with ILE or with RPG? Why > wouldn't the call using *NOPASS work like using *OMIT? > > Use the example Charles gave in another message why should: > > MyProc(parm1:*omit); > MyProc(parm1) > > be any different? > *NOPASS works for parameters passed by value as well as parameters passed by reference. A null pointer couldn't be passed for say an integer parameter. If a null pointer was passed for const or reference *NOPASS parameters, it would make the %PARMS count incorrect. If you mean "why doesn't the system put some default value where the parameter would be if it were passed", that's an ILE thing I guess, but I don't think any system does that, passing "something" for unpassed parameters. Most of the OPTIONS in RPG allow increased flexibility for calling the procedure at the cost of increased complexity in the procedure itself. They allow the caller to bypass the normal rules, but the programmer of the procedure then has to check whether the rule has been bypassed. (I think it's a fair trade-off, since the complex-to-write procedure is only written once, while the easier-to-call prototype might be used for thousands of call statements.) Farfetched scenario: The difference between those two calls of yours might be important to some procedures. Say your first version of MyProc only had one parameter, and your second version has new *OMIT parameter. You want old callers to still be able to call your procedure, so you also make it *NOPASS. Here's the farfetched part: maybe your procedure wants to be able to tell whether it has an old caller or a new caller.
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.