×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Steve,

I'm not exactly sure of the logic flow.  How is Proc1 called?  The *NoPass
option only means that the parameter doesn't have to be passed (Null).  To
determine if it was passed the number of parameters needs to be checked.

Proc 2 always thinks it was passed an argument because it is.  Using field
InArg1 in the call will always send that field to Proc2.  If you don't want
to pass a parameter unless it is received by Proc1 wrap the call to Proc2 in
an if statement that verifies a parameter was received and makes the
appropriate call to Proc2 based on the result.

Hth,

Rick

 -----Original Message-----
From:   Steve Richter [mailto:srichter@autocoder.com] 
Sent:   Wednesday, January 08, 2003 11:03 AM
To:     Chat. Rpg400-L
Subject:        passing along *NoPass arguments


Proc1 receives an arg that is *NoPass:

pProc1            b
dProc1            pi
d InArg1          n         options(*NoPass)
 /free
      Proc2( InArg1 ) ;
 /end-free
p                 e

and passes it along to Proc2 which also defines the arg as *NoPass:
pProc2            b
dProc2            pi
d InArg1          n         options(*NoPass)
 /free
      if    %parms >= 1 ;
        dsply   'Arg1 is passed' ;
      endif ;
 /end-free
p                 e

In practice, Proc2 always thinks it was passed an argument.  Even when Proc1
is called without an arg value.

Shouldnt passing a not passed *NoPass argument either signal an exception or
pass along the *NoPass indicator?

I was hoping that options(*NoPass:*Omit) was the answer.  That a missing arg
value would be passed as *Omit and passed downstream as *Omit also.  But it
does not work that way.  Unless Proc1 is called as "Proc1( *Omit ) ;", Proc2
will think it was passed something.


Steve Richter


_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo.cgi/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

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