Previous Topic: Connecting Members to Sorted Indexed SetsNext Topic: Retrieving Indexed Records


Disconnecting Records from Indexed Sets

Assume that the DEPT-EMPLOYEE set in the sample database is an indexed set sorted by employee identification number (EMP-ID-0415). To disconnect an occurrence of the EMPLOYEE record, a program could issue the following requests:

MOVE '0019' TO EMP-ID-0415.
FIND CALC EMPLOYEE.
DISCONNECT EMPLOYEE FROM DEPT-EMPLOYEE.

Processing the Request

CA IDMS/DB processes these requests as follows:

  1. Finds the SR8 record pointed to by EMPLOYEE record 19's index pointer.
  2. Searches the SR8 record for EMPLOYEE 19's db-key. If CA IDMS/DB finds EMPLOYEE 19's db-key, processing skips to Step 3. If CA IDMS/DB does not find EMPLOYEE 19's db-key, processing continues as follows:
    1. CA IDMS/DB decrements the SR8 record's orphan count by 1. If the SR8 contains no entries and the orphan count is 0 CA IDMS/DB erases the SR8 record.
    2. CA IDMS/DB follows SR8 records until it finds the db-key.
    3. CA IDMS/DB updates EMPLOYEE 19's index pointer to point to the correct SR8 record.
  3. Removes EMPLOYEE 19's key entry from the bottom-level SR8 record and rewrites that SR8 record.
  4. If this were an unsorted set, processing would be complete. Since this is a sorted set, if EMPLOYEE 19's symbolic key is the highest key in the SR8 record, CA IDMS/DB passes up the key to each level in which the key is the highest and removes the entry for EMPLOYEE 19 from each successive SR8 record.