|
Assuming you are using RPGIV, here's a sample program that makes a
prototyped dynamic call to a program that receives and returns an array.
First the calling program:
Darray s 9p 0 dim(12)
Dyear s 4s 0 inz(1999)
D* Procedure prototype for call to arraypgm
Darraypgm pr extpgm('ARRAYPGM')
Darrayparm like(array) dim(12)
Dyearparm like(year)
C
C callp arraypgm(array : year)
C
C eval *inlr = *on
****************** End of data *************************
Now the called program, its name is ARRAYPGM, you'll need that because
it's identified in the calling program as that:
D* Procedure prototype
Darraypgm pr
Darrayparm 9p 0 dim(12)
Dyearparm 4s 0
D* Procedure interface (actual definition of parms)
Darraypgm pi
Darrayparm 9p 0 dim(12)
Dyearparm 4s 0
D* array index
D x s 5u 0
C
C do 12 x
C eval arrayparm(x) = 19990031 + 100 * x
C enddo
C eval *inlr = *on
I actually tested this, and it returns an array to the calling program
no problem.<g>
Depending on what your needs are, you might consider a static call to
the program that returns the dates by creating it as a module or service
program. I've skipped some of the niceties of parameter definition in
the interest of brevity. I don't think all of the dates returned by the
called program are valid. <g> The trick to passing an array is to make
sure you identify it as an array with the dim keyword on the procedure
prototype and the procedure interface.
I like Brian Meyers' book, the title escapes me, but it contains the
word "jumpstart." Don't know what you'd consider a non snippet, but he
has some examples that you can compile and run without writing any
additional code.
> -----Original Message-----
> From: Carl Pitcher [mailto:cpitcher@roadrunner.nf.net]
> Sent: Tuesday, October 26, 1999 2:14 PM
> To: RPG400-L@midrange.com
> Subject: RPG parameters
>
>
> I am developing a program (V4R2) which needs to pass a fiscal year to
> another program and return the 12 fiscal period ends which I
> would like to
> define 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.
>
+---
| 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 mailing list archive is Copyright 1997-2025 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.