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



James,

Because you specifically mentioned ILE there is another way to
accomplish this.

If you prototype the call you can use the keyword *NOPASS to accomplish
what has been mentioned in the other replies.  It works the same way as
having a fixed parm list and not passing all of them.

Also on prototyped calls you can use the *OMIT keyword which allows you
to omit parameters in the middle of the list.  Instead of passing a
parameter you would use *OMIT as the parameter value.  The called
program would then test for the address of the parameter.  If it is not
null a value was passed, is it is null the parameter was omitted.

In the caller you would have:
d LstMbrs         pr              *                         
d                               20                          
d                               10    Options(*NOPASS: *OMIT)
d                               20    Options(*NOPASS: *OMIT)
d                                8    Options(*NOPASS: *OMIT)
d                                1    Options(*NOPASS: *OMIT)

 /Free

        LstMbrs(Parm1 :*Omit :*Omit :Parm4 :Parm5);

 /End-Free

In the called program you would check for the parms something like this:
 * If a member name value is passed use it, else default to '*ALL'.

c                   If        %parms < 2 Or %Addr(P_MbrNme) = *NULL

c                   Eval      MbrNme = '*ALL'



c                   Else

c                   Eval      MbrNme = P_MbrNme

c                   EndIf



 * If no user space name given use default.

c                   If        %parms < 3 or %Addr(P_QualUsrSpc) = *NULL
or
c                               P_QualUsrSpc = *blanks

c                   Eval      QualUsrSpc = DftSpcNme



c                   Else

c                   Eval      QualUsrSpc = P_QualUsrSpc

c                   Endif                           

Rick                    

> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx
> [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of James H H Lampert
> Sent: Wednesday, March 15, 2006 4:31 PM
> To: rpg400-l@xxxxxxxxxxxx
> Subject: Quick question (and I think it's come up before)
>
> Fellow geeks:
>
> Is there a way to have a couple of optional parameters in an
> ILE RPG program?
>
> --
> JHHL
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
> mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
>
>

Privileged and Confidential.  This e-mail, and any attachments there to, is 
intended only for use by the addressee(s) named herein and may contain 
privileged or confidential information.  If you have received this e-mail in 
error, please notify me immediately by a return e-mail and delete this e-mail.  
You are hereby notified that any dissemination, distribution or copying of this 
e-mail and/or any attachments thereto, is strictly prohibited.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.