Previous Topic: Clustering records around a chained setNext Topic: Storing Variable-Length Records


Storing records via an indexed set

Storage Order

Indexed sets can be used to store member records in a physical order that reflects the order of the member's db-key or symbolic key in the index, by defining the member record's storage mode as via (or clustered) an indexed set that is sorted on db-key or symbolic key.

Determining the Target Page

CA IDMS/DB determines the target page on which to store a member occurrence via an indexed set, as follows:

If this is the first record occurrence stored via a user-owned index set or a system-owned index with the same page range as the member record...

CA IDMS/DB determines the target page as follows:

  • If the member or owner in the set are assigned to the same page range, CA IDMS/DB stores the member record occurrence as close as possible to the owner record (allowing for record displacement if specified).
  • If the member and owner in the set are assigned to different page ranges, CA IDMS/DB stores the member record as close as possible to the page (within the member's page range) that is proportional to the location of the owner (within the owner's page range).

If this is the first record occurrence stored via a system-owned index with a separate page range from that of the member...

The target page is the low page of the member's page range

If other record occurrences have already been stored (that is, if the index is not empty)...

CA IDMS/DB determines the target page, as follows:

  • If the set is sorted by db-key, CA IDMS/DB finds the highest db-key of a record that is already a member of the indexed set, and uses the page specified in this db-key as the target page.
  • If the set is sorted by symbolic key, CA IDMS/DB determines the target page for the new record as follows:
  • Identifies the SR8 record that will hold the symbolic key for the new record
  • Finds the db-key of the record with the preceding or following symbolic key in the index and uses the page specified in this db-key as the target page

Example

For example, the EMP-EXPERTISE set in the sample order entry database is an indexed set, and EXPERTISE records are stored in physical-sequential order based on the value of the SKILL-LEVEL field. The non-SQL schema DDL statements necessary to specify physical-sequential placement of the EXPERTISE record are as follows:

               RECORD NAME EXPERTISE
                  LOCATION MODE VIA EMP-EXPERTISE SET ...

               SET NAME EMP-EXPERTISE
                  ORDER SORTED
                  MODE INDEX ...
                  OWNER EMPLOYEE
                  MEMBER EXPERTISE ...
                     DESCENDING KEY SKILL-LEVEL ...

In this case, CA IDMS/DB stores each EXPERTISE record as close as possible to the record with the next lower SKILL-LEVEL.