× 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.



The *Null check works if the parameter as defined with Options(*omit).
The %parms check works with Options(*nopass)

Whenever I have an optional parameter, I (almost) always define it as Options(*omit: *nopass) and then do the following check:
If %parms >= %parmNum( parmField ) and %addr( parmField ) <> *Null;

%parmNum is one of the many cool benefits of upgrading to Ibm i 7.1

-Kurt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Addison
Sent: Friday, April 13, 2012 12:05 PM
To: 'RPG programming on the IBM i / System i'
Subject: RE: Can RPG procedures in a *SRVPGM have optional parameters?

Another option is to check if the address of the parameter is *Null or not.

If %addr(optional1) <> *Null;
....


Alan Addison

-----Original Message-----
From: Jon Paris [mailto:jon.paris@xxxxxxxxxxxxxx]
Sent: April-12-12 8:45 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Can RPG procedures in a *SRVPGM have optional parameters?


On 2012-04-12, at 6:57 PM, rpg400-l-request@xxxxxxxxxxxx wrote:

Yes you can have optional parameters...you'll have to check %parms()
to see if the parm was passed. Also all parameters after the first
optional parameter must also be optional/no pass.

And if you are on V7 or later you should use %ParmNum to check for optional
parms rather than hard code against %Parms.

e.g. If %Parms >= %ParmNum(optional1); Rather than

If %Parms >= 2;


Jon Paris

www.partner400.com
www.SystemiDeveloper.com








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-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.