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



In that case, how about:

       p example         B                   export
       d                 pi            10i 0 opdesc
       d  piParm1                   32767    const
       d options(*varsize:*nopass:*omit)
       d  piParm2                   32767    const
       d options(*varsize:*nopass:*omit)
 
       d  p1Exists                        N
       d  p2Exists                        N
 
 /free
   if %parms() = 2;
       exampleWithDft(piParm1 : piParm2);

   elseif %parms() = 1;
       exampleWithDft(piParm1 : P2_DEFAULT_VALUE);

   elseif %parms() = 0;
       exampleWithDft(P1_DEFAULT_VALUE : P2_DEFAULT_VALUE);

   endif;
/end-free

Then define the procedure "exampleWithDft" to do whatever you would have 
done in "example", but without all the nasty if statements.  This way, 
whoever is using your procedure gets the benefit of a simpler interface, 
and you get the benefit of writing the important logic in a 
straightforward way without worrying about which parameters are defined.



rpg400-l-bounces+aglauser=erbgroup.com@xxxxxxxxxxxx wrote on 30/08/2006 
10:37:17 AM:

This method gets complicated when a procedure has several of those parms
and needs to use them to call another procedure later. 

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
AGlauser@xxxxxxxxxxxx
Sent: Wednesday, August 30, 2006 9:32 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: Allocate field with options(*nopass :*omit)

If you are concerned about copying the parameter value, what about:


      p example         B                   export
      d                 pi            10i 0 opdesc
      d  piParm1                   32767    const
 options(*varsize:*nopass:*omit)
      d  piParm2                   32767    const
 options(*varsize:*nopass:*omit)

      d  p1Exists                        N
      d  p2Exists                        N

/free
  if %parms() >= 1;
      p1Exists = *on;
  endif;

  if %parms() = 2;
      p2Exists = *on;
  endif;


 if        p1Exists
     .... Do something
 else
     .... Do something else
 endif

 if        p2Exists
     .... Do something
 else
     .... Do something else
 endif
/end-free

Hope this helps,
Adam

P.S. - Sorry if font is small ... I'm trying to figure out why this
happens.



#####################################################################################
Attention:
The above message and/or attachment(s) is private and confidential and is 
intended 
only for the people for which it is addressed. If you are not named in the 
address 
fields, ignore the contents and delete all the material. Thank you. Have a nice 
day.

For more information on email virus scanning, security and content
management, please contact administrator@xxxxxxxxxxxx
#####################################################################################

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.