Dynamic Array Definition

thenewguy

New Member
I hav ea program that uses quite a few arrays and the EXTENT was originally 9. Everywhere that the max was referenced, the number 9 was the index. The first time I looked at the program and had to make a change because I needed it to be 10, I created a scoped define variable at the start. I set it to 10, and everywhere needed, I replaced the numeric index to use the new scoped define variable. This has worked well enough.

Now the need to increase the arrays by 2 extents has arisen. I am looking for a way to have the program do a lookup to determine how many extents i need and have that set dynamically. Thus far I have run into the problem of the extent needing to be a constant.

Is it possible to dynamically define the extent value at run time? This would put an end to me having to modify the program whenever the criteria changes as our business grows.

Each extent corresponds to data pertaining to a prticular location. As we add more locations, the program ends up needing to be modified. I am trying to NOT have to rework the entire application and stay within the existing structure.

Any suggestions would be appreciated.
 
you could use a delimited string ( character field ).

the delimiter can be a comma or special character, like, chr(1) depending on what it is you're planning to put in them.

num-entries, entry, lookup etc. functions and add your own.
 
Arrays are not dynamic in Progress, so if you want a dynamic structure you will have to use something else, eg. string, temp-table, whatever.

You can determine the extent of an array dynamically (EXTENT function), so AFTER you define it, access to the max number is run-time only.

Without amending your application structure to avoid arrays, I'm afraid your options are limited.

To be honest, I don't find them useful except in small doses, and it may be a good idea to bite the bullet now, and replace them with something more workable before the problem gets worse as the application grows.
 
Back
Top