|
Here here. I learned that the hard way in one of the very first programs I did for someone (Under MS-DOS 2.0) "How big do I need to make this array? Are you absolutely sure it will never ever need more than 500 elements? Positive? Okay, I'll make it 5000 just to be sure. Now, you're positive there will never be more than 500 elements? Okay." 6 months later I was back when the program was crashing when it was trying to load more than 5000 elements. And somehow the source had disappeared. So I wound up doing a kludge breaking the data up into 10 blocks so the program wouldn't crash anymore. Ever since then, I never take the users word on anything having to do with data sizes, and I will try to never hardcode array sizes for user data. You just never know. Now, the problem Himasnhu, is that an array can only go up to 32767 (or 32766) records. What is going to happen when some user tries to enter 32770 records? Your program is going to crash and burn, and you won't have a ready fix for it, other than kludging and using 2 arrays now, etc... Best to just go the file, user space, etc.. route where you don't have a cap. Regards, Jim Langston -----Original Message----- From: Booth Martin [mailto:Booth@MartinVT.com] ah! yes, Himasnhu, you understand the problem perfectly! As you do more in the AS/400 World you will come to realize that what you describe happening is very typical. 5 records today, 2,000 next year, 150 000 five years from now. Yes, nearly all of us would recommend "Should I go for one more database file" solution because we have all seen sudden changes happen. Think *NOMAX in all your planning. -------Original Message------- Booth, A fine day I start coding one program, in which I am fetching records from database file and based on certain conditions I am storing in array to process in a batch.(Today I have only 5 records satisfying the criterion). what you feel. Should I go for one more database file to store all selected records if not what dimension I can choose for array ?? Say 500 but what about a year after when the selection criterion start selecting 1000 records. I feel only solution is REDIM array if possible with RPGLE. Don't suggest any other way to store records like open query or something.. my requirement may be to use arrays only. Himasnhu
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.