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



Hello Mike,

You wrote:
>Thanks, one more question. How can I tell if that parameter was passed or
>not?

That depends on how the parameter was coded on the prototype.

OPTIONS(*NOPASS) means the parameter is optional, i.e., it may not even be
there at all.

OPTIONS(*OMIT) means the parameter is omissable.  That means it is required
but you can specify *OMIT to cause a null pointer to be passed.

MEMORISE THIS *********
Optional and omissable are distinctly different things and not
interchangeable!
***********************

If the parameter is coded as OPTIONS(*NOPASS) then use %PARMS to check the
parameter count.

C               IF      ( %PARMS >= 2 )
 *              do stuff

If the parameter is coded as OPTIONS(*OMIT) then a null pointer is passed
and %PARMS will count it.  You can test the address using %ADDR and
comparing for *NULL. (You can also call CEETSTA to test for the omitted
argument but %ADDR is easier.)

C               IF      ( %ADDR(parm1) <> *NULL )
 *              do stuff

If the parameter was coded as OPTIONS(*NOPASS : *OMIT) then you MUST use
%PARMS followed by a call to CEETSTA to test for an omitted argument.  The
reason you must do it this way is that if the parameter was not specified
at all CEETSTA will fail with a missing descriptor (or worse, pick up a
descriptor on the stack from a previous function call).  If *OMIT was
specified then %PARMS will count it as a parameter. You must do both things
to know whether you have a valid parameter or not.

C               IF      ( %PARMS >= 2 )
C               CALLP   ceeTestArg( argOmitted : 2 : *OMIT )
C               ENDIF

C               IF      ( %PARMS >= 2 AND
C                         argOmitted = $CEE_ARG_OMITTED_NO )
 *              do stuff

NOTE: In the above example I have prototyped the CEETSTA bound procedure so
I can use it on CALLP.  Without the prototype you have to code:

C               CALLB   'CEETSTA'
C               PARM                    argOmitted
C               PARM    2               argNbr
C               PARM                    *OMIT

(or something like that -- I haven't used CALLB for years)

Regards,
Simon Coulter.

--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists
   http://www.flybynight.com.au/

   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175   mailto: shc@flybynight.com.au   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



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.