%TLOOKUPxx (Look Up a Table Element)
%TLOOKUP(arg : search-table {: alt-table})
%TLOOKUPLT(arg : search-table {: alt-table})
%TLOOKUPGE(arg : search-table {: alt-table})
%TLOOKUPGT(arg : search-table {: alt-table})
%TLOOKUPLE(arg : search-table {: alt-table})
- %TLOOKUP
- An exact match.
- %TLOOKUPLT
- The value that is closest to arg but less than arg.
- %TLOOKUPLE
- An exact match, or the value that is closest to arg but less than arg.
- %TLOOKUPGT
- The value that is closest to arg but greater than arg.
- %TLOOKUPGE
- An exact match, or the value that is closest to arg but greater than arg.
If a value meets the specified condition, the current table element for the search table is set to the element that satisfies the condition, the current table element for the alternate table is set to the same element, and the function returns the value *ON.
If no value matches the specified condition, *OFF is returned.
The first two parameters can have any type but must have the same type. They do not need to have the same length or number of decimal positions.
The ALTSEQ table is used, unless arg or search-table is defined with ALTSEQ(*NONE).
Built-in functions %FOUND and %EQUAL are not set following a %LOOKUP operation.
The %TLOOKUPxx built-in functions use a binary search for sequenced tables (tables that have the ASCEND or DESCEND keyword specified). See Sequenced arrays that are not in the correct sequence.
For more information, see Array Operations or Built-in Functions.
*..1....+....2....+....3....+....4....+....5....+....6....+....7...+....
/FREE
*IN01 = %TLOOKUP('Paris':tab1);
IF %TLOOKUP('Thunder Bay':tab1:tab2);
// code to handle Thunder Bay
ENDIF;
/END-FREE