Previous Topic: CURRENTNext Topic: Updating Data


RETURN

The RETURN function can be used to directly access the index of either user-owned or system-owned index sets.

The structure of an index set differs from a chained set since it is implemented through a pointer array, or index, between the owner record and the member record occurrences. The index contains the db-key and symbolic key of each of the member records and is always located in the same area as the owner of the set, which may be different than the area in which the member records reside.

A user program can directly access the index to retrieve the db-key and, optionally, the symbolic key if one is defined, of an index entry using the RETURN function instead of or in addition to using FIND/OBTAIN functions to retrieve the indexed member records from the database.

The RETURN function supports the following options:

Unlike FIND/OBTAIN requests, RETURN requests affect only the currency of the indexed set and do not affect currency for the run unit or records participating in the set.

In the following figure, the RETURN function is used on the EMP-NAME-NDX indexed set. In the first function, the db-key and symbolic key of the first EMPLOYEE are returned into the variable storage fields IDBKEY and IEMPLOYEE. In the next function, the db-key and symbolic keys of the last EMPLOYEE are returned. In the third function, the db-key of the 'Peter Plum' EMPLOYEE record is returned. Note that in each of the examples, only the index currency is affected.