|
How did your program skip 64 records at a time, using a keyed file? I was under the impression that you can't use RRN to advance the records on keyed files (already sorted) ...Or do you have an ODP that's already sorted, and use the RRN on that file but just do put the 'K' attribute on the F spec? tim -----Original Message----- From: David Morris [SMTP:dmorris@plumcreek.com] Sent: Thursday, September 23, 1999 3:07 PM To: RPG400-L@midrange.com Subject: Re: "extract" command enhancement (subfiles and BIFs) Jim, I recently spent some time trying to optimize a page by page subfile positioning routine. I started by reading every 4096th record until I hit a greater key and then went back/forth by half until I hit 1 or the key. Worked pretty good, but it was slower than my sequential search which just read every 64th record and then backed up when it found a key greater. I found out that with a scrollable cursor, to get the record n records away the system actually performed I/O for all of the inner records. Seems odd to that the system performs I/O when simply counting index entries would do. David Morris >>> Jim Langston <jlangston@conexfreight.com> 09/23/99 01:24PM >>> Incidentally, this "halving" technique is one I learned years ago in school from a math teacher. By using the halving technique, you can pick any number from 1 to 100 within 7 "guesses", with the average being 4 or 5 (not 3.5 because of the refinement on each consecutive pick).. On a simple sequential search, 1, 2, 3, 4, etc... it could take 100 picks, with the average being 50. With 1000 records the halving technique would take at most 10 guess, and I'm not even going to try to figure out the average (7 maybe?). With sequential search, max 1000 and average of 500. It's a really good technique, and I have used it in searches before, but there is the necessity that your data is sorted on what you're looking for. And this is basically the exact same way the OS does it when it does a SETLL. Regards, Jim Langston +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-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-2025 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.