NET/MASTER Network Control Language (NCL) Programmer's Guide

Working With Single Key-Sequenced Files
Working With Files
12–62 106160 Tandem Computers Incorporated
Generic Retrieval
Generic retrieval assumes that the value of the current key is a partial key. A partial
key is a truncated version of a full key. In a partial key, only some of the leading
characters are supplied.
Retrieval by partial key is normally used when the entire key is not known or when
many records have keys that are similar. For example, if the value of a full key in a
record is RECORD_1, then you could use the following partial keys to search for the
record:
KEY=REC
KEY=RECORD
KEY=RECORD_
Generic retrieval retrieves the first record when the value of the key in the record
partially matches the value of the current key. You have only one option when
retrieving a record generically. The option is outlined in the following steps:
1. Set the current key by using the FILE SET verb, for example:
FILE SET KEY=ABCDEF
2. Retrieve the first record that generically matches the current key by using a FILE
GET verb that specifies a generic retrieval option, for example:
FILE GET OPT=KEQ ARGS
After the FILE GET verb generically retrieves a record, it sets the retrieval direction of
subsequent FILE GET verbs either forward or backward. Subsequent FILE GET verbs,
which use the same OPT operand, sequentially retrieve all other records that match
the partial key.
Table 12-6 lists the options you can use to specify the method of generic retrieval and
set the retrieval direction to forward.
Table 12-4. Generic Retrieval Options That Set Direction Forward
Option Meaning
KEQ Retrieves a record with a record key generically equal to the specified key and
sets retrieval direction forward.
KGE Retrieves a record with a record key generically greater than or equal to the
specified key and sets retrieval direction forward.
KGT Retrieves a record with a record key generically greater than the specified key and
sets retrieval direction forward.