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

A simpler way to check if a parameter has been passed or not is using
the combination OPTIONS(*NOPASS) in your procedure definition and the
operator %parms in your procedure. This operator gives you the number of
effectives parameters that has been passed to your procedure.

This is one thing, but I know it does not give you an answer to your
question. But there's something you omit saying in your message: was
your SQLRPGLE program using the %ADDR operator on a constant procedure
parameter ?

Regards,

Michel Delisle

>>> mattt@wincofoods.com 10/09/02  17:50 >>>
Hello,

I have module I am going to create into a *SRVPGM.  In that is a
sub-procedure to return the condition of whether the date passed is in a
leap year or not.  When I compile this module as an SQLRPGLE (because
there
is code that uses embedded SQL), it compiles just fine.  If I remove the
embedded SQL code and change the type to RPGLE and compile the module I
get
the error message RNF0341 in every sub-procedure where I use the %ADDR()
BIF.

My question is why does SQLRPGLE act differently that RPGLE in this
case?

My reason for using %ADDR() was to find out by field name that the field
was
not passed when calling the sub-procedure so that I can default in the
current date.  I wanted to write a piece of code that did not require
the
field be in a certain parameter position in case I use this code in
another
procedure without the complexity of calling the operational descriptor
API.

ERROR MESSAGE: RNF0341:
Message . . . . :   The parameter for %ADDR is not valid; %ADDR is
ignored.

Cause . . . . . :   The parameter for built-in function %ADDR must be a
field
  name. If the field name is an indexed array, an array index may also
be

  specified. The following fields cannot have their address taken
because
the
  fields cannot be modified:

  -- Lookahead fields

  -- User-Date fields UDATE, UDAY, UMONTH, UYEAR, *DATE, *DAY, *MONTH,
*YEAR

  -- Input-only parameters (CONST keyword specified on the parameter

    definition)

  -- *IN1P and *INMR

Recovery  . . . :   Correct the parameter for built-in function %ADDR.
Compile
  again.


PROTOTYPE:
     D isleapyr        pr              N
     D  inpdate                        d   const
     D                                     options(*omit)

PROCEDURE:
     Pisleapyr         b                   EXPORT
     D isleapyr        pi              N
     D  inpdate                        d   const
     D                                     options(*omit)

     D leapyearsts     s               N   static
     D workdate        s               d   static
     D x               s             10U 0
     D year            s              4s 0

     C                   IF        %addr(inpdate) = *NULL
     C                   IF        workdate <> CurrDate
     C                   EVAL      workdate = CurrDate
     C                   ELSE
     C                   RETURN    leapyearsts
     C                   ENDIF
     C                   ELSE
     C                   IF        workdate <> inpdate
     C                   EVAL      workdate = inpdate
     C                   ELSE
     C                   RETURN    leapyearsts
     C                   ENDIF
     C                   ENDIF

     C                   EXTRCT    workdate:*Y   Year
     C                   IF        %rem(YEAR: 4) = 0
     C                   EVAL      leapyearsts =  *on
     C                   ELSE
     C                   IF        %rem(YEAR: 400) = 0
     C                   EVAL      leapyearsts =  *on
     C                   ELSE
     C                   EVAL      leapyearsts =  *off
     C                   ENDIF
     C                   ENDIF

     C                   RETURN    leapyearsts

     P                 E
_______________________________________________
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/cgi-bin/listinfo/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.