|
Hello Joel, It strikes me that this is a trade-off between performance and application maintenance. The READE loop discarding 'uninteresting' records is probably the easiest to maintain but the CHAIN is likely to be more efficient. For only 100 records it hardly matters. READE is a strange beast. If the key is an exact match database will do the selection. If you are using a partial key RPG will do the selection. This is certainly true for RPG/400 and I think also for RPG IV. For a partial key your program is moving more data into the program and your code is going to ask for records only to discard them as 'uninteresting'. In general, get database to do the work rather than your code. Never move more data than you must. Fixing the I/O is the quickest way to fast application performance -- assuming a hardware upgrade to a faster box is not possible :). Both READE and CHAIN perform similarly. An index lookup is performed for the key and the data is fetched from the file. Same amount of work. A better consideration for performance is CHAIN vs. SETLL for priming a read loop. Regards, Simon Coulter. «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«» «» FlyByNight Software AS/400 Technical Specialists «» «» Eclipse the competition - run your business on an IBM AS/400. «» «» «» «» Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 «» «» Fax: +61 3 9419 0175 mailto: shc@flybynight.com.au «» «» «» «» Windoze should not be open at Warp speed. «» «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«» //--- forwarded letter ------------------------------------------------------- > X-Mailer: Internet Mail Service (5.0.1460.8) > Date: Fri, 12 Feb 99 10:04:11 -0800 > From: "Joel Fritz" <JFritz@sharperimage.com> > To: "'MIDRANGE-L@midrange.com'" <MIDRANGE-L@midrange.com> > Reply-To: MIDRANGE-L@midrange.com > Subject: random i/o and relative efficiency > > For what I'm doing at the moment, it's academic, but I'm curious anyway. > > I'm working on a program that needs to access most of the records in a file > for a given partial key. There are about 100 records for each partial key > and of those, about 80 are "interesting." All of the records that need to > be skipped are in the first quarter of the range for a given partial key; > the remainder are contiguous. I've noticed that other programs that use > this file will chain to the 5 to 10 "interesting" records in the beginning > of the range and then chain to the first "interesting" record in the > contiguous part of the range, processing the remainder of the records in a > reade loop. Is this faster than chaining to the first record that matches > the partial key and reading every record (chain--reade loop) processing only > the "interesting" records using simple logic? The program I'm working on is > interactive and only reads 100 or so records for each screen, so performance > really isn't an issue. > > I guess the real question is what is the performance difference, if any, > between a chain and a reade, or how many reades make a chain? > > Joel Fritz x1568 +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.