|
"Stone, Brad V (PP)" wrote: > > -----Original Message----- > --snip-- > > P.S. BTW this can also be used to speed up LOKUP operations on an > ordered array. > > Any idea as to what search method a LOKUP (LOOKUP) uses? > +--- Brad, AFAIK, it does an entry by entry compare starting with the set index value. Sort of like: z-add 1 x arg dowle ara,x add 1 x enddo (or is that DOUGT ... now let's not revisit the DOW DOU wars! ) But I hope you get the drift. I have not reviewed generated code lately, but the last time I looked into it, there was a high operation byte count (instructions executed) therefore machine cycles used therefore slow execution. Now I'm not even going to try to count spaces to do this, but typical code would be: (RPGIII/400) z-add 1 x arg lokup ara,x 91 90 > or = One could binary halve the array to set the initial value for "x" and eliminate, some times, 25-50-75% of the array. If the compiler now has an automatic halving technique for an array defined as ascending or descending fill me in. Come to think of it, the compiler *should* use halving for such an array. IMHO, to mirror an ordered subfile key into an ordered array just adds another layer of programmed synchronization and a potential for failure. The value is already in the subfile (in order), why take up more resource to replicate? Let's see, 9,999 potential elements per subfile times value length times number of users or managing dynamic user space when about 50 lines of code can do the job? I don't think so. I was just about to post the code when I recalled a list guideline against such, but if anyone would like a cloneable set of routines feel free to contact me privately. James W. Kilgore email@James-W-Kilgore.com +--- | 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.