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



On 12/16/2010 9:56 AM, David FOXWELL wrote:

Thanks, but I don't remember ever coding ASCEND. Surely that is implicit?


ASCEND is implicit for sorting, but not for lookup. If you code ASCEND on your array, RPG will assume the array is already in ascending order for %LOOKUP and will use a fast binary search. If you don't code either ASCEND or DESCEND, RPG will not make any assumption about the order, and will use a sequential search.

So for your table, which doesn't have ASCEND or DESCEND, the %TLOOKUP will do a sequential search, and the elements don't have to be ordered.

David, if you haven't already solved this, check in the debugger to make sure that element really is in your table on the statement where you do the %TLOOKUP.

Use this debugger command:
===> EVAL TABERA(1..99)

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.