Previous Topic: @FIND/@OBTAIN CALC/DUPLICATENext Topic: @FIND/@OBTAIN DBKEY


@FIND/@OBTAIN CURRENT

The @FIND/@OBTAIN CURRENT statement accesses the record that is current of its record type, set, or area. This form of the @FIND/@OBTAIN verb is an efficient means of establishing the proper record as current of run unit before executing a DML verb that utilizes run-unit currency (for example, @ACCEPT, @IF, @GET, @MODIFY, or @ERASE).

Currency - Following successful execution of an @FIND/@OBTAIN CURRENT statement, the accessed record is current of run unit, its area, its record type, and all sets in which it currently participates as member or owner.

Syntax

►►─┬─ @FIND ───┬────── CURRENT ───────────────────────────────────────────────►
   └─ @OBTAIN ─┘

 ►─┬────────────────────┬─────────────────────────────────────────────────────►
   ├─ ,REC=record-name ─┤
   ├─ ,SET=set-name ────┤
   └─ ,AREA=area─name ──┘

 ►─┬───────────────────────────┬──────────────────────────────────────────────►◄
   └─ ,KEEP= ─┬─ SHARED ──────┬┘
              └─ EXCLUSIVE ───┘

Parameters

@FIND/@OBTAIN CURRENT

Accesses the record occurrence that is current of run unit.

REC=record-name/SET=set-name/AREA=area-name

Specifies that the current record of the named record type, set, or area is to be accessed.

REC=

Accesses the record that is current of run unit.

record-name

A register containing the record name, a user-defined variable field, or a user-supplied value enclosed in quotation marks.

SET=

Accesses the set that is current of run unit.

set-name

A register containing the set name, a user-defined variable field, or a user-supplied value enclosed in quotation marks.

AREA=

Accesses the area that is current of run unit.

area-name

A register containing the area name, a user-defined variable field, or a user-supplied value enclosed in quotation marks.

KEEP=

Places a shared or exclusive lock on the accessed record.

SHARED

Places a shared lock on the specified record.

EXCLUSIVE

Places an exclusive lock on the specified record.

Example

The following figure illustrates the use of the @FIND/@OBTAIN CURRENT statement to establish a record as current of run unit before that record is modified. (See @MODIFY later in this chapter for a complete description of the @MODIFY verb and its use.) Enter the database on DEPARTMENT 5100 by using CALC retrieval. Then examine EMPLOYEE 466 and obtain further information from its owner OFFICE record. OFFICE 8 becomes current of run unit. Before modifying EMPLOYEE 466, you must issue the @FIND CURRENT statement to reestablish EMPLOYEE 466 as current of run unit.

Status Codes

After completion of the @FIND/@OBTAIN CURRENT function, the ERRSTAT field in the IDMS communications block indicates the outcome of the operation. The following is a list of the acceptable status codes for this function and their corresponding meaning:

0000

The request has been serviced successfully.

0301

The area in which the named record participates has not been readied.

0306

Currency has not been established for the named record, set, or area.

0308

The specified record is not in the subschema. The program has probably invoked the wrong subschema.

0310

The subschema specifies an access restriction that prohibits retrieval of the named record.

0313

A current record of run unit has not been established or has been nullified by a previous @ERASE statement.

0323

The area name specified has not been included in the subschema invoked.

When the KEEP parameter is specified, a major code of 06 will be returned if an error occurs during the KEEP processing. The major code of 03 states that an error has occurred in the @FIND/@OBTAIN processing.