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



This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
Define AR1 as an array of 99 elements (that would seem like plenty).

   C              Eval       AR1(Age) = Ar1(Age) + 1
   C              If         *InLR
   C              Eval       Age = 1
   C              Do         99
   C              If         AR1(age) > 0
   C              Exsr       WriteLineSR
   C              Eval       Age = Age +1
   C              EndIf
   C              XFoot      AR1
   C              Exsr       WriteTotalSR
   C              EndDo
   C              EndIf

------------------------------------------------
Booth Martin
Booth@MartinVT.com
http://www.MartinVT.com
-----------------------------------------------




"Wills, Mike N. (TC)" <MNWills@taylorcorp.com>
Sent by: rpg400-l-admin@midrange.com
09/06/2001 06:06 PM
Please respond to rpg400-l


        To:     "'RPG400-L@midrange.com'" <RPG400-L@midrange.com>
        cc:
        Subject:        Array help


Okay, for some reason I can't remember how to do this. I need to count the
number of people for each age that work within the company (for
demographics
stuff). The problem is that I forgot how to deal with multiple arrays.

The way I am doing this (...and I am open to better ways) is to create a
multi-column array that holds the age and the count. When I process an
employee, I will lookup to see if the age is in the array. If it is, I add
1
to my counter. If not, I add the age in to my array. But, I would like it
in
numeric order so when I go to print it out, it is in age order.

I guess what I would like to know what the best approach to this would be.
I
haven't dealt with arrays for a while again. Is my idea a good approach
for
this? How do I create a 2-column array? Example:

Ages             AgeCount
21               5
35               6
18               1
20               10
45               50

Thanks for any help given....

Mike Wills
_______________________________________________
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.