Previous Topic: Performing an Area SweepNext Topic: Accessing a Record by Its db-key


Accessing Owner Records

To access the owner record of the current record of set, perform the following steps:

  1. Establish the current of set for the specified set type (for example, by issuing an OBTAIN CALC).
  2. If the set is defined with either the optional or the manual set membership option, issue the IF MEMBER statement to determine set membership status.
  3. Issue the FIND/OBTAIN OWNER command.
  4. Perform the IDMS-STATUS routine if the DBMS returns a nonzero value.

How FIND/OBTAIN OWNER Works

FIND/OBTAIN OWNER uses the current of set and locates the owner of that set occurrence.

Checking for Set Membership

Since an optional member may have been disconnected from the set and a manual member may never have been connected to the set, you cannot assume that such a record is actually connected to an occurrence of the set. Failure to check membership may result in obtaining the owner of another record, the one that is the current of set. If a member record is declared with either the optional or the manual set membership option, you should use the IF statement (explained in Checking for Set Membership) to determine whether the current record is presently connected to the specified set before issuing the FIND/OBTAIN OWNER command.

OWNER Retrieval in Optional or Manual Sets

The program excerpt and the figure below illustrate OWNER retrieval for sets with either the optional or the manual membership option. Records defined to sets with either the optional or the manual option may not be connected to a set occurrence; you can use the DML IF statement to test for set membership.

Owner Retrieval for Mandatory Automatic Sets

A member record declared as a mandatory automatic member of a set must be connected to an owner record. Such records are connected to a set occurrence when they are stored and cannot be disconnected. Therefore, you need not test for set membership prior to obtaining the set owner. The following program excerpt and figure illustrate OWNER retrieval for mandatory automatic sets.