× 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.



hey all,

i'm trying to trim a few microseconds per record off of my weekly 2 million
record update.

I've loaded a conversion table into two field array / data structure - the
table is several hundred records.

this is how I coded the array:

D                 DS
D $items                              dim(9999) ascend
D $aItem                              like(AITEM) overlay($items:1) inz(0)
D $pItem                              like(PITEM) overlay($items:*next)
inz(0)

and my lookup looks like this:

C                   eval      $dx = %lookup(CITEMNUM:$aItem:$look1)

C                   if        $dx > 0
C                   eval      CITEMNUM = $pItem($dx)
C                   end

I found this entry in the archives:

<snip>
> > I could not find a reference in the RPG Reference, but I believe the
> > LOOKUP opcode always does a read/compare loop, while the %lookup BIF
does
> > a binary search.

> Just to clarify: Yes, the LOOKUP opcode always does a sequential
> search through the data. %LOOKUP() and %TLOOKUP() do a binary search
> on ordered arrays only. That is, arrays with keyword ASCEND or
> DESCEND. Otherwise, it's still a sequential search.

> Cheers!  Hans

here are my questions:

1.  would the lookup be faster if I changed it to a table %tlookup rather
than a paired field array %lookup?

2.  does my example above still do a binary search (which i assume is
faster) even though the array argument of my lookup bif is only part of the
array ds which doesn't have the ascend keyword, while the DIMmed field has
the ascend keyword?

thanks,

Rick



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.