Previous Topic: FIND/OBTAIN DBKEYNext Topic: FIND/OBTAIN WITHIN SET USING SORT KEY


FIND/OBTAIN OWNER

The FIND/OBTAIN OWNER statement locates the owner record of the current occurrence of a set. This statement can be used to retrieve the owner record of any set whether or not that set has been assigned owner pointers.

Native VSAM users: The FIND/OBTAIN OWNER statement is not valid since owner records are not defined in native VSAM data sets.

Currency

In order to execute a FIND/OBTAIN OWNER statement, currency must be established for the specified set.

Note: When a record declared as an optional or manual member of a set is retrieved, it is not established as current of set if it is not currently connected to the specified set. A subsequent attempt to retrieve the owner record will locate instead the owner of the current record of set. In such cases, you should determine whether the retrieved record is actually a member in the specified set before executing the FIND/OBTAIN OWNER statement. The IF MEMBER statement, explained later in this chapter, can be used for this purpose.

Following successful execution of a FIND/OBTAIN OWNER statement, the accessed record becomes the current record of run unit, its record type, its area, and all sets in which it currently participates as member or owner. If the current record of set is the owner record when the statement is executed, currency within the specified set remains unchanged.

Syntax
►►─┬─ FIND ───┬─┬────────────────────────┬─ OWNER SET (set-name); ────────────►◄
   └─ OBTAIN ─┘ └─ KEEP ─┬─────────────┬─┘
                         └─ EXCLUSIVE ─┘
Parameters
FIND/OBTAIN OWNER SET (set-name)

Specifies the set whose owner record is to be retrieved. Set-name must be a set included in the subschema.

KEEP EXCLUSIVE

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

Example

The following figure illustrates use of the FIND/OBTAIN OWNER statement to move through the database.

Status Codes

Upon completion of the FIND/OBTAIN OWNER 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 object record participates has not been readied.

0306

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

0308

The named 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 object record.

0360

A record occurrence has been encountered whose record type is not a member or owner of the set as it is defined in the subschema.

0370

A database file will not open properly.

If the KEEP parameter is specified in a FIND/OBTAIN statement, and an error occurs during KEEP processing, the major code 06 is returned. For more information, see KEEP CURRENT, later in this chapter. The major code 03 is returned if an error occurs during FIND/OBTAIN processing.