×

Good News Everybody!

The new search engine is LIVE!

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




To account for the case where no parameter was passed in that position at
all, by checking %parms I verify that a parm was really there and then the
%addr checks to see if it was *omit.  Here is an excerpt of a post by
Barbara Morris on the iseriesnetwork forum that explains why you need the
%parms check first.

<excerpt>
When you access an unpassed parameter, the system looks at the parameter
stack where the parameter would be if it had been passed. You can't rely on
that area containing a non-pointer. Code using this technique tends to break
unexpectedly and apparently randomly.

You can use %addr(parm) = *null to test whether options(*omit) parameters
have had *omit passed, as long as they don't also have options(*nopass).
Unfortunately, the compiler won't allow this for CONST parameters.
<end of excerpt>

Scott Mildenberger

> -----Original Message-----
> From: rob@dekko.com [mailto:rob@dekko.com]
> Sent: Tuesday, February 19, 2002 7:32 AM
> To: rpg400-l@midrange.com
> Subject: RE: Optional Parameters in Subproceedures
>
>
>
> If you are using the %addr, then why bother with the %parms?
>
> Rob Berendt
> --
> "They that can give up essential liberty to obtain a little temporary
> safety deserve neither liberty nor safety."
> Benjamin Franklin
>
>
>
>                     Scott
>                     Mildenberger            To:
> "'rpg400-l@midrange.com'" <rpg400-l@midrange.com>
>                     <Smildenber@Washc       cc:
>                     orp.com>                Fax to:
>                     Sent by:                Subject:     RE:
> Optional Parameters in Subproceedures
>                     rpg400-l-admin@mi
>                     drange.com
>
>
>                     02/19/2002 09:22
>                     AM
>                     Please respond to
>                     rpg400-l
>
>
>
>
>
>
> Simon,
>
> In the OPTIONS(*NOPASS : *OMIT) case is there any reason you
> can't use the
> %parms and %addr together?  At least that is how I do it, just curious
> because in the first part of your message you mentioned %addr
> was easier to
> use but you didn't use it here.  Want to make sure I'm not missing
> something
> by doing the following:
>
>  C                   IF        ( %PARMS >= 2 ) and (%addr(TheParm) <>
> *NULL)
>   ***  The parm can be used.
>  C                   ENDIF
>
> Scott Mildenberger
>
> > -----Original


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