|
I suppose I should also emphasize that this does require that the file or logical you are using is sorted in the same order as your key. So when I said READE is like Chain, what I mean is that is uses a key and does a comparison against the whole file, whereas READ just moves right on to the next record without reading through anything. If your file is already sorted in the order you want, then READ is definitely faster than READE. >-----Original Message----- >From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] >On Behalf Of Fleming, Greg (ED) >Sent: Wednesday, November 23, 2005 8:05 AM >To: RPG programming on the AS400 / iSeries >Subject: RE: Optimizing File I-O in RPG IV/ I-Series > >I'm sure the gurus can explain it better than I, but READE actually >performs a bit counter-intuitively. > >It actually resets the pointer every time it is invoked. So you setLL the >first time, then when you READE it looks at your key and reads through all >the records again to get to the next one, and so on. At least that's the >way it's been explained to me. We made it a standard in our shop to never >use READE, and when we did, the performance of our programs improved >dramatically. > >Instead, we use: > >Key SetLL File >DoW 1 = 1 >Read File >If %Eof or Key <> Record > Leave >EndIf >Process Record >EndDo > > >Greg >
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.