Access Methods for Selected Records

Contents
idms
Contents
This section describes how Quick Bridge determines how to access entry records, primary path records, and auxiliary records, starting with a description of how it uses unique keys to select record occurrences for each record type on the primary path.
Use Unique Keys to Access Records on the Primary Path
The generated table procedure uses one of two access strategies when it uses unique keys to return a record occurrence for each record type on the primary path:
  • Plural Access
    -- If the table procedure receives fewer values than the number of defined unique key fields for a record type, it returns all record occurrences for that record type to the SQL engine for the current owner relationship.
  • Unique Access
    -- If the table procedure receives a value for each defined unique key field for a record type, the table procedure returns a single occurrence of that record type to the SQL engine for the current owner relationship.
Note:
If you do not define a unique key for a particular record type, the table procedure uses the plural access method for that record type. The data returned to the SQL engine for a particular record occurrence is subject to additional filtering by the SQL engine. See the CA IDMS SQL Reference to determine when values from an SQL statement will be passed to the table procedure for a particular type of query and how SQL engine filtering may affect the resultant table.
Plural Access
Plural access returns all occurrences of a particular record type to the SQL engine for the current owner occurrence. To satisfy this requirement, table procedures generated by Quick Bridge sequentially process the record type based on its position in the primary path. Entry records that:
  • Are members of a mandatory/automatic system-owned index are accessed using that index to find all its member records.
  • Do not participate in a mandatory/automatic system-owned index are accessed by performing an area sweep until all record occurrences for that record type are found.
For path records, the set relationship is used to return all members for the current owner occurrence. Target records that are linked with the path through a SET which is not automatic, will always be accessed using an area sweep.
Unique Access
Unique access returns a single occurrence of a particular record type to the SQL engine for the owner occurrence. To satisfy this requirement, generated table procedures process the record type based on its position in the primary path. The following section describes strategies employed to obtain unique occurrences of entry, path, and auxiliary records.
Unique Access Strategies for Entry, Path, and Auxiliary Records
This section describes strategies Quick Bridge uses to obtain unique record occurrences of entry, path, and auxiliary records.
Unique Access Methods for Entry Records
For entry records, the method used to locate unique record occurrences is determined by which fields were selected as unique keys for that record type. An entry record can be either a CALC type record, a member of a (preferably mandatory/automatic) system-owned index, or both.
When the entry record access mode is CALC and is not a member of a system-owned index:
  • The access mode for the record type is CALC if all of the unique keys fields selected in Quick Bridge match the CALC key fields
    exactly
  • Otherwise, the record type is accessed using an area sweep
When the entry record is a member of a system-owned index:
  • The access mode for the record type is also CALC if the record has a CALC access mode and all fields selected in Quick Bridge match the CALC key fields
    exactly
  • Otherwise, the access mode for the record type is INDEX SET USING, if all fields selected in Quick Bridge match the sort elements of the index set exactly. The INDEX SET USING access mode requires that the unique key fields, that make up the index, are specified in the same order as the sort elements of the index set are defined in the network schema. Otherwise, the record type is accessed by walking through the index.
When the record type is accessed using an area sweep or by walking an index, the values passed to the table procedure are compared to the values in the current record occurrence. The area sweep or index walk continues until the values match.
The rules defined on the previous page anchor the query to a single occurrence of the entry record.
Unique Access Method for Path Records
For every other record type in the primary path, the access strategy walks the set relationships from the owner of that relationship to the next member of the relationship. When the next member of the set is obtained, CA IDMS compares the values returned from the current record occurrence to the values supplied to the table procedure in the unique query. An exact match makes the record occurrence unique for that record type for the current owner relationship.
Unique Access Methods for Auxiliary Records
An auxiliary record is a record that participates in a set relationship with the target record, but is not part of the primary path. The generated table procedure locates unique occurrences of auxiliary records in one of two ways:
  • In Next Row processing, each auxiliary record is located as owner in the auxiliary relationship. The query returns the auxiliary record's unique key to the SQL engine for filtering.
  • In Insert Row and Update Row processing (when the foreign key is changed), the auxiliary record is located by one of four ways.
    • CALC access mode
      -- When the unique keys fields selected in Quick Bridge match the CALC key fields exactly, the record type uses CALC access mode
    • INDEX SET USING access method
      -- When the auxiliary record is a member of a system-owned index and the unique key fields selected in Quick Bridge match the index key fields exactly, the INDEX SET USING access mode is being used. The INDEX SET USING access mode requires that the unique key fields, that make up the index, are specified in the same order as the sort elements of the index set are defined in the network schema.
    • Indexed access
      -- When the auxiliary record is a member of a mandatory/automatic system-owned index, CA IDMS compares all record occurrences in that index to the values passed to the table procedure. The single unique record occurrence with that key becomes the object of the new or updated set relationship.
    • Area sweep
      -- When the auxiliary record cannot be accessed by one of the above methods, each record occurrence for that record type in the area is compared to the values passed to the table procedure. The single unique record occurrence with that key becomes the object of the new or updated set relationship.
Modify the Selected Access Method
Sometimes the selected access method does not perform the most "correct" method for your database structure. You can change the table procedure code to reflect your understanding of the database design. For example:
  • The auxiliary record is CALC, but the unique keys for that record type contain more than the CALC key fields. This condition makes Quick Bridge perform an area sweep. You could enhance the table procedure code to perform OBTAIN CALC DUPLICATE processing which could be more efficient than an area sweep.
  • The auxiliary record is not CALC, but is owned by a CALC record. You could include additional columns in the CREATE TABLE PROCEDURE and table procedure code to support the foreign key to that auxiliary record. Then add the required code to return the data in SELECT processing, and the required code to perform UPDATE processing.