Another way to optimize a lookup (especially when the array may only be partially filled) is to begin filling the array from the bottom up. That is ... in a 999-element array use element 999, 998, 997, etc. At completion of the fill routine save the number of the last element used.
Then on subsequent lookups to the array, use the saved value for a start point for the lookup ... "VALUE LOKUP ARRAY,X". By doing this, you only search the used portion of the array.
================================== MORE INFORMATION ON THIS TOPIC ==================================
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
Requires Free Membership to View
Register today to access targeted resources from our editorial writers and independent industry experts including news, tips, and advice to help you do your job more efficiently and effectively. Stay informed on the hottest topics and biggest challenges faced by IT professionals working with iSeries products and services.
This was first published in February 2002