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


FIND/OBTAIN CURRENT

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

Currency

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

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

 ►─┬────────────────────────┬─ ; ─────────────────────────────────────────────►◄
   ├─ RECORD (record-name) ─┤
   ├─ SET (set-name) ───────┤
   └─ AREA (area-name) ─────┘
Parameters
FIND/OBTAIN CURRENT

Locates the current record occurrence of a specified record type, set, or area.

KEEP EXCLUSIVE

Places a shared (KEEP) or exclusive (KEEP EXCLUSIVE) lock on the accessed record.

RECORD (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.

Example

The following figure illustrates use of the FIND/OBTAIN CURRENT statement to establish the proper record as current of run unit before the record is modified.

Assume that you enter the database on DEPARTMENT 5100 by using CALC retrieval. You examine EMPLOYEE 466 by using within set retrieval and obtain further information from its owner OFFICE record (OFFICE 8). 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.

Note: For more information about MODIFY statement and its use, see MODIFY RECORD.

Status Codes

Upon completion of the FIND/OBTAIN CURRENT function, the ERROR_STATUS field in the IDMS DB communications block indicates the outcome of the operation:

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 named record or set 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 either has not been established or has been nullified by a previous ERASE statement.

0323

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

If the KEEP parameter is specified in a FIND/OBTAIN statement, and an error occurs during KEEP processing, the major code 06 is returned.

Note: For more information, see KEEP CURRENT, later in this chapter. The major code 03 is returned if an error occurs during FIND/OBTAIN processing.