LOOKUP

Syntax

LOOKUP lookup_table_name{key_any_lit|_var|_col} {ret_txt_var|_date_var}

Description

Searches a lookup table (an array) for a key value and returns the corresponding text string.

Speeds up processing for long reports. For example, if you want to print the entire state name rather than the abbreviation, you could use LOAD-LOOKUP and then LOOKUP to do this.

Parameters

Parameter Description

lookup_table_name

Specifies the lookup table. This table must have been loaded previously with a LOAD- LOOKUP command.

key_any_lit | _var | _col

The key used for the lookup.

ret_txt_var | _date_var

A string variable into which the corresponding value is returned.

Example

The following example works in conjunction with the example for the LOAD-LOOKUP command:

lookup  states  &state_abbr  $state_name

This example searches the states lookup table for a matching &state_abbr value; if the value is found, the example returns the corresponding state name in $state_name. If it is not found, a null is placed in $state_name.

See The LOAD-LOOKUP command