SEARCHUP
Use the SEARCHUP function to look up data within a series of data that is sorted in ascending code-page byte-order.
The SEARCHUP function performs a binary search on the sorted series and returns a related object that corresponds to the item found.
The byte-order of characters varies by code page. For example, because the ASCII A character (0x41) has a higher numeric value than the ASCII 0 character (0x30), the SEARCHUP function requires the 0 character to be sorted before the ASCII A character in the series. The EBCDIC A character (0xC1) has a lower numeric value than the EBCDIC 0 character, so the SEARCHUP function requires the EBCDIC A character to be sorted be before the EBCDIC 0 character in the series.
The HCL Link Data Language property values change the collation order of some characters. For example, the German National Language property value is arranged in byte order, with the exception of certain characters: æ is ordered after a, e is ordered before ä, and so forth. There are particular collation rules for other National Language property values. However, there is no collation order for "Western" and "Japanese" property values, and the deprecated Data Language property values are always in byte order.
- Syntax:
- SEARCHUP (series-object-expression, series-item-object-expression, single-item-expression)
- Meaning:
- SEARCHUP (corresponding_object_to_return, ascending_items_to_search, item_to_match)
- Returns:
- A single object
SEARCHUP performs a binary search on the item series of ascending_items_to_search. The ascending_items_to_search must be sorted in ascending code page byte-order. The value to search for is specified as the item_to_match and must be of the same type as the ascending_item_to_search.
The object returned (corresponding_object_to_return) must be related to ascending_items_to_search by a common object name. If no match is found, SEARCHUP returns "none".
Examples
- SEARCHUP (Age Column:Row:DBSelect,
SSN Column:Row:DBSelect, SSN_Value:Message)
If there are ten rows in DBSelect, the search starts by comparing the first SSN Column of the fifth Row with the SSN_Value in Message. If the result matches, SEARCHUP returns the first Age Column of that Row. If the value of SSN Column is greater than the SSN_Value in Message, the search continues with the third Row. If the value of SSN Column is less than the SSN_Value in Message, the search continues with the seventh Row in DBSelect. The search continues in this fashion until either a match is found or until one Row is selected. If there is more than one SSN Column for the selected Row, a similar search is initiated for all SSN Column's for the selected Row in DBSelect.
SEARCHUP returns the first Age Column for the selected Row of DBSelect.
Related functions
- EXTRACT
- LOOKUP
- SEARCHDOWN