10.6.6 Indirect Lookups

Indirect lookups are a special type of expression. The operator used to specify an indirect lookup is ->, and must be preceded by an expression and followed by a field reference, as in the following:

expression -> [fname.]fldname

The field reference fldname is used to determine a lookup file. If fldname is not unique, the file name must be given explicitly, as in:

fname.fldname

The value of expression must be equal to the primary key value of a record in the lookup file. The lookup file's primary key field must be declared in its FIELD declaration list.

The result of the -> operator is the value of fldname from the lookup file. If no matching record is found, however, the result is equal to expression.

Since the result of the -> operator is itself an expression, it may be used as expression for subsequent -> operators, as in:

expression -> [fname.]fldname -> [fname.]fldname

It is important to note that, although there is no limit as to the actual number of -> operators within a single statement, the same rules regarding field referencing and primary key definition apply to each and every indirect lookup performed. Note also that they are evaluated in order from left to right.