The way I do it is this: The halt only happens if you try to refer to a parameter not passed, So don't refer to it. :) I name my parameter field a unique name and never use it inside the program. I have a if/else/end that says

if  %parms = 1
eval workfield = parm1
else
eval workfield = *zeros
endif

then at LR time I might say
if %parms = 1
eval parm1 = workfield
endif

That way, if no parm is passed, the program still runs because field parm1 is never called out. Of course you don't need to limit it to one parm, but it does have to be in order. You can't skip any parms. If you use parm 4 then you must have parm 1, 2, &3.





James H H Lampert wrote:
Fellow geeks:

Is there a way to have a couple of optional parameters in an ILE RPG program?

--
JHHL

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2025 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.