Previous Topic: @FIND/@OBTAIN DBKEYNext Topic: @FIND/@OBTAIN USING SORT KEY


@FIND/@OBTAIN OWNER

The @FIND/@OBTAIN OWNER statement accesses the owner record of the current set occurrence. You can use this statement to retrieve the owner record of any set whether or not that set has been assigned owner pointers.

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

Currency

To execute an @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 named set. A subsequent attempt to retrieve the owner record will instead locate the owner of the current record of set. In such cases, you should determine whether the retrieved record is actually a member of the named set before issuing the @FIND/@OBTAIN OWNER statement. The @IF statement (see @IF in this chapter) can be used for this purpose.

Following successful execution of an @FIND/@OBTAIN OWNER statement, the accessed record becomes the current record of run unit, its area, its record type, 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 in the specified set remains unchanged.

Syntax

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

 ►─── ,SET=set-name ──────────────────────────────────────────────────────────►

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

Parameters

@FIND/@OBTAIN OWNER

Accesses the owner record of the specified set occurrence.

SET=set-name

Names the set whose owner record is to be retrieved. Set-name must be a set included in the subschema; it can be a register, a user-defined variable, or a user-supplied variable enclosed in quotes.

KEEP=

Places a shared or exclusive lock on the accessed record:

SHARED

Places a shared lock on the accessed record.

EXCLUSIVE

Places an exclusive lock on the accessed record.

Example

The following figure provides an example of how you would use the @OBTAIN OWNER statement, in conjunction with other @OBTAIN statements, to navigate the database and access the owner record of the OFFICE-EMPLOYEE set from the owner record occurrence of the DEPT-EMPLOYEE set.

Status codes

After completion of the @FIND/@OBTAIN OWNER 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 named record or the named set is not in the subschema, or the named record is not defined as a member of the named set. The program has probably invoked the wrong subschema. or the record name has been misspelled.

0310

The subschema specifies an access restriction that prohibits retrieval of the named 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

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