Previous Topic: Shared Table Updating

Next Topic: OPT=IGEN

Retrieval Techniques

The &VARTABLE GET statement allows an NCL procedure to retrieve an entry from a vartable, placing the key, data, counter, and possibly user correlator, into nominated NCL variables. The specific entry returned depends on both of the following:

The default OPT= parameter is OPT=KEQ, which searches the nominated vartable for an exact EQUAL KEY match.

Most of the other OPT= values are straightforward:

KGE

Retrieve the entry with the lowest key value greater than or equal to the supplied key value.

KLE

Retrieve the entry with the highest key value less than or equal to the supplied key value.

KGT

Retrieve the entry with the lowest key value greater than the supplied key value.

KLT

Retrieve the entry with the highest key value less than the supplied key value.

GEN

Retrieve the entry with the lowest key value generically equal to the supplied key value (that is, match for as many non-blank characters in the supplied argument, and the fewest non-blank characters after).

Two OPT= values allow retrieval of the entry with the lowest key (OPT=FIRST), or highest key (OPT=LAST). When used in conjunction with the OPT=KGT or OPT=KLT options in a loop, a table can be sequentially read (the &VARTABLE GET description illustrates this).