|
If you want to know how many are filled I'd suggest: /FREE For x=1 to %elem(myarray); If myarray(x) <> ''; y = y + 1; EndIf; EndFor; /END-FREE Ron Power Programmer Information Services City Of St. John's, NL P.O. Box 908 St. John's, NL A1C 5M2 709-576-8132 rpower@xxxxxxxxxx http://www.stjohns.ca/ ___________________________________________________________________________ Success is going from failure to failure without a loss of enthusiasm. - Sir Winston Churchill Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 2006/04/21 03:20 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc Subject Re: Determining Dynamic Array Size > Is there a BIF that will tell me how many elements I have in an array? Yes, %ELEM. HOWEVER -- your subject (but not the text of the message) uses the word "dynamic" which makes me wonder if you're dynamically allocating memory for the array. If you are, then you MUST keep track for yourself of how many elements you've allocated. %ELEM will always report the number you declared on the DIM statement, it doesn't know how much memory you've allocated.
As an Amazon Associate we earn from qualifying purchases.
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.