Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max number of Arrays (Or should I use Multiple Occurrence DSs?)

Status
Not open for further replies.

CHMoore

Programmer
Oct 27, 2003
1
US
I have a program that I wrote using Arrays....it has been requested to be enhanced to include some additional information. If I stay w/the same logic my program won't compile due to number of arrays exceeds 200. I'm thinking about rewriting the program and using multiple occurrence data structures. Any ideas on how to handle? Do you think using work files would be a better solution?

Thanks bunches....
CHMoore
 
If this is an RPG III program, consider converting it to RPG IV syntax.

It doesn't say how many arrays/tables you can have in the "Restrictions" section of the RPG IV manual (the RPG III manual does show a limit of 200).

RPG IV:
RPG III:

"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci
 
Since you are having a problem with the number of arrays I assume you have more than 200 fields which you are storing, each in its own array? You could try setting up a data area of all of these fields as subfields of one long string then holding this field in a single array. It means that you would have to move the data to and from the array element but it should work.
Code:
D Structure    DS        1000             
D  Field1                   3
D  Field2                   5  0
D  Field3                  10

D Holding      S         1000    DIM(999)

C          Eval   Structure = Holding(1)
C          Eval   Field1 = 'aaa'
C          Eval   Field2 = 50
C          Eval   Field3 = 'bbbbbbbbbb'
C          Eval   Holding(1) = Structure
It acheives the same thing as using a multi-occurence DS but without setting the OCCUR and remembering which occurence you are currently working with.

PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top