Previous Topic: FIND/OBTAIN CALCNext Topic: FIND/OBTAIN DB-KEY


FIND/OBTAIN CURRENT

Purpose

Accesses a record that is current of run unit, current of the record's record type or area, or current of any set in which the record participates as member or owner.

Syntax

►►──┬─ FIND ───┬───┬──────────────────────────┬───────────────────────────────►
    └─ OBTAIN ─┘   └─ KEEP ───┬─────────────┬─┘
                              └─ EXCLUSIVE ─┘

 ►──── CURRENT ───┬────────────────────┬────┬────────────────────┬── . ───────►◄
                  ├─ record name ──────┤    └─ error-expression ─┘
                  ├─ WITHIN set-name  ─┤
                  └─ WITHIN area-name ─┘

Parameters

KEEP

Places a shared lock on the object record.

EXCLUSIVE

Places an exclusive lock on the object record.

CURRENT

Accesses the record occurrence that is current of run unit.

record-name

Specifies the current occurrence of the named record to be accessed.

WITHIN set-name

Specifies the current occurrence of the named set to be accessed.

WITHIN area-name

Specifies the current occurrence of the named area to be accessed.

The named record, set, or area must be known to the dialog's subschema.

error-expression

Specifies the status codes that are returned to the dialog.

Usage

FIND/OBTAIN CURRENT is an efficient means of establishing a record as current of run unit before executing a command that uses run-unit currency (for example, ERASE, GET, or MODIFY).

After successful execution of a FIND/OBTAIN CURRENT command, the accessed record is current of:

Considerations

If autostatus is not in use, a dialog's error-status field indicates the outcome of a FIND/OBTAIN CURRENT command:

Status code

Meaning

0000

The request was executed successfully

0306

Currency was not established for the named record, set, or area

0308

The object record is not in the dialog's subschema

0310

The dialog's subschema specifies an access restriction that prohibits retrieval of the object record

0313

Run-unit currency was not established or was nullified by a previous ERASE command

0323

The named area is not in the dialog's subschema

0329

A run-unit deadlock condition occurred. DBMS aborted and rolled back the run unit. All resources associated with the task are released

Example

The statements in the following example establish an ITEM record as current of run-unit before issuing a command that requires run-unit currency:

MOVE 'BB' TO ORD-NUM.
OBTAIN CALC ORDOR.
OBTAIN FIRST ITEM WITHIN ORDER-ITEM.
OBTAIN OWNER WITHIN PRODUCT-ITEM.
OBTAIN CURRENT ITEM.
MODIFY ITEM.

The object ITEM record becomes current of run unit following the third statement. The fourth statement establishes the owner PRODUCT record as current of run unit. The OBTAIN CURRENT statement reestablishes the ITEM record as current of run unit.

More information:

Error Handling