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



Rory,

I don't think your case statement will evaluate correctly... You should
start with "%parms > 9" and work your way down... As written, case will
always select the first clause, since this will always evaluate to true
whenever %parms > 2....

-Eric DeLong

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Rory Hewitt
Sent: Tuesday, August 18, 2009 11:02 AM
To: RPG programming on the IBM i / System i
Subject: Re: CALL with optional parameters

Here's an example of what Jon's talking about:

D PgmToCallName S 21A
D PgmToCall PR Extpgm(PgmToCallName)
D Parm1 10A Const
D Parm1 10A Const
D Parm1 10A Const Options(*Nopass)

PgmToCallName = 'MYLIB/MYPGM';
PgmToCall( 'ABC' : 'DEF' : 'GHI' );

Back to the OP's original question though, the quick answer is that
aside
from the various techniques to prototype the call (which will only
minimize
the amount of code), you still have to explicitly do the check for the
extra
parm. Not a huge problem if you're talking about 1 extra parm, but if
there
are lots, then you get something like this:

select:
when %parms > 2;
PgmToCall( Parm1 : Parm2 : Parm3 );
when %parms > 3;
PgmToCall( Parm1 : Parm2 : Parm3 : Parm4 );
when %parms > 4;
PgmToCall( Parm1 : Parm2 : Parm3 : Parm4 : Parm5 );
....
when %parms > 9;
PgmToCall( Parm1 : Parm2 : Parm3 : Parm4 : Parm5 : Parm6:
Parm7: Parm8: Parm9: Parm10 );
endsl;

I've done this to 'wrapper' an internal (unexported) procedure.

Nothing you can do about it.

Rory


On Tue, Aug 18, 2009 at 8:14 AM, Jon Paris <jon.paris@xxxxxxxxxxxxxx>
wrote:

Yes you can - simply remove the quotes from the program name on the
EXTPGM and the compiler treats it as a variable just as with the old
CALL/PARM method.


Jon Paris


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.