bsearch: A Better %LOOKUP
February 8, 2012 Jon Paris
Note: The code accompanying this article is available for download here. In qsort: A Better SORTA, I described the use of the qsort API. This time, we’ll be looking at its companion API–bsearch–which, as its name suggests, is used to perform searches. Recent changes in array support in RPG, including V6.1’s abilities to define large arrays, means that I use bsearch less frequently than I used to. Nevertheless, the fact that I write the code that controls the matching still makes it useful. For example, I can code bsearch to search for a partial string, which is something |