×
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.
My first reaction is to say that you could put this into a service program which persists across multiple procedure calls from different programs within the same activation group to prevent the loading of the array every time the program is called.
Off the top of my head here are some things I consider when thinking about loading an entire file into an array:
1. Is loading the entire file into an array less I/O than the amount of I/O if I didn't?
2. Is the file mostly static (contents aren't changing)? Or if the file did change would it happen while the program is running? If it does change do I have a way to safely end and restart the service program?
3. What's the size of the file? This is arbitrary, I simply prefer to only load smaller files into arrays. What's small to me? I guess up to 500 records - usually when I do this sort of thing there are only around 20 records however.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of David FOXWELL
Sent: Wednesday, June 03, 2009 4:22 AM
To: RPG programming on the IBM i / System i
Subject: Array vs file access
Hi all,
We have some old RPGIII that are using arrays instead of files. These programs are used by a lot of different applications and can be called many times by the same program. The programs in question load a file into an array in the INZSR, then each time the program is called, it's the array that is searched instead of the file. Apparently, this is or was supposed to be quicker. The program however, needs to be maintained as eventually the arrays get overfilled as records get added to the file.
Is this kind of thing justified? If not, was it ever?
The boss is saying that it is not, because repeatedly chaining to the same record by different calls to the program would mean that the record would always be available in memory without having to read from disk. I think that's possible, but no way of knowing for sure. When the program was written, only 50 records were in the file. Now there are more than 800.
For now, I'm going to increase the size of the array in the program that's causing problems. I was thinking, however, that this program would be an ideal candidate for our shop's first ever service program, as all our RPGIV do a bound call to this program via an encapsulating program.
Any thoughts?
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.