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


  • Subject: Re: RPG parameters
  • From: "Scott Klement" <infosys@xxxxxxxxxxxx>
  • Date: 27 Oct 1999 00:38:56 -0500

"Carl Pitcher" <cpitcher@roadrunner.nf.net> wrote:
>
> I am developing a program (V4R2) which needs to pass a fiscal year t
>  another program and return the 12 fiscal period ends which I would
>  like to as an array.  Since *ENTRY PLIST doesn't allow passing of
>  array elements or data structures, are there any suggestions as to
>  how I can implement this without passing 12 PARM fields for the
>  dates and then moving them to array elements on the return? Also
>  can anyone recommend a book that provides some good, complete
>  examples (not snippets) of ILE programming. Thanks.

What do you mean by "ILE Programming"?   Do you mean ILE RPG?  Or
do you mean ILE COBOL, ILE CL, ILE C?   Or are you referring to
the actual act of creating/binding/calling ILE routines?  Like
using the CRTxxxMOD, CRTPGM, UPDPGM, CRTSRVPGM, CRTBNDDIR commands?

Parameters to a program are passed by reference.  (This is true in
RPG III as well as RPG IV)  In other words, the only thing passed
from program to program is the address of the parameter in memory.

As long as you understand this, you can actually pretty much pass
ANYTHING as a parameter.  The only thing you need to remember is
that you'll have problems if the parameters aren't the same on both
ends of the call :)

Here's some sample programs that demonstrate this, written in RPG IV:
(or, if you prefer, ILE RPG -- tho I'm not using ILE at all here,
these will run just fine as standalone programs compiled in the
default activation group)

(To those of you who'll automatically assume that this is the way I
write my production code:  This is just an example, I really don't
use PLIST's and CALL's in my real code, but for a beginner learning
RPG IV for the first time, this is easier, and less scary...)



PGM1:

D Array           S               D   DIM(13)

C                   CALL      'PGM2'
c                   PARM                    ARRAY

c                   do        13            x                 2 0
c     array(X)      dsply
c                   enddo

c                   dsply                   Wait              1

c                   eval      *INLR = *on



PGM2:

D Array           S               D   DIM(13)
D MyDate          S               D   INZ(d'1998-12-31')

C     *ENTRY        PLIST
C                   PARM                    Array

C                   do        13            x                 2 0
c     MyDate        adddur    x:*months     Array(X)
c                   enddo

c                   eval      *inlr = *on

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


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.