Very easy. If you send me an e-mail I will send you an example program that
demonstrates how to do dynamic arrays. I don't want to paste in because
everything wil get smashed.

Basically you just define the array as 32767 elements and base it on a
pointer. You maintain two counters and you allocate or reallocate the array
as you expand. The surprising thing is that IBM does not provide native
support for this. Note much to it but you would think the compiler would
support it.

On Thu, Jul 30, 2009 at 2:26 PM, Shannon ODonnell <
sodonnell@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Is this even possible?



I want to define an array as, say, 100 elements, with 2 fields in it (or 3
or 4.).



If I only need to fill 3 of those elements, I only want to return an array
size of 3 elements to the caller (probably called through a java bean or
possibly through a PHP call, but not necessarily). I DO NOT want to return
100 elements, with 3 filled and 97 empty.



Is that even possible with RPG?



I can't for the life of me figure out the array definition syntax if it is.





Shannon O'Donnell



--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].