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



I know what you mean.  Unfortunately I haven't found any other way around it
yet. :(

Rick

 -----Original Message-----
From:   Steve Richter [mailto:srichter@autocoder.com] 
Sent:   Wednesday, January 08, 2003 3:09 PM
To:     RPG programming on the AS400 / iSeries
Subject:        RE: passing along *NoPass arguments

Hi Rick,

I am writing something that is very procedure heavy, lots of procs calling
other procs.  Up until today my *NoPass:*Omit arguments were working as I
wanted, but testing a new batch of code today showed me otherwise.

So as procedures pass along optional arguments to other procedures, my
procedures wind up containing a lot of code that sets up the actual value of
the argument:

  if  %parms >= 3  and not (%addr(InArg2) = *Null ) ;
    ActualArg2 = InArg2 ;
  else ;
    ActualArg2 = 'some default value' ;
  endif ;

That is ok, but I dont like the idea of having to include such code in an
intermediate proc that just routes the pgm flow to some worker proc:
   pgm mainline calls proc1( ) ;
   proc1 calls either proc1a( arg1 )  or  proc1b( arg1 ) ;

thanks,

Steve

-----Original Message-----
From: rpg400-l-bounces@midrange.com
[mailto:rpg400-l-bounces@midrange.com]On Behalf Of Chevalier, Rick
Sent: Wednesday, January 08, 2003 2:32 PM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: passing along *NoPass arguments


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


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