×
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.
Hi Rory,
Here is a quick sample program that shows how we can pass *OMIT along a call chain:
http://code.midrange.com/e73d188de3.html
In this program I have created a proc1 and proc2 with the following pi:
d procX pi
d parm1 1a
d parm2 1a options(*omit : *nopass)
d parm3 1a options(*omit : *nopass)
proc1 calls proc2 as follows:
proc2(parm1 : parm2 : parm3);
Note: ALL THREE of its parms (whether they are passed, omitted, or missing) are ALWAYS passed to proc2.
proc1 is called from the main procedure in the following ways:
proc1(var1 : *omit : var3);
proc1(var1 : var2);
proc1(var1);
In all three instances proc1 happily passes parm1, parm2, and parm3 to proc2, even when they are not passed to proc1. This is fine if a *OMIT is passed because proc2 can still check the address and if not null use it. It is the calling of proc2 with all three parms using parameters that were not passed to proc1 that is the real danger. The value of %parms within proc2 will always be 3 in every call from proc1 so it is of no use in checking if a parm was passed. Checking the address is now a danger too because sometimes it actually might not be null - even when the parm was not passed.
Copy-n-paste the code. Compile and run it in debug. You should check the values as the calls are made. The debugger will give you 'pointer not set for location referenced' in proc1 and proc2 for parm2 when it is omitted. What it will give for the missing parms in proc2 is anybody's guess. Sometimes it will even give you a value - even though it was never passed!
Cheers, and have fun!
Larry Ducie
As an Amazon Associate we earn from qualifying purchases.