Entry Segment Retrieval of Network Records

In this section:

As described in Adapter for CA-IDMS Reporting Techniques, a retrieval subtree is constructed based on the Master and Access Files and your request. The root of this subtree is called the entry segment because retrieval search of the data source begins at that point. The actual IDMS retrieval calls used on the entry segment depend on the Access File information for the entry segment and the selection criteria in the request. To perform the most efficient record retrieval on the entry segment, the adapter chooses one of the following techniques:

  1. Retrieval by the IDMS database key (DBKEY).
  2. Retrieval by the CALC field.
  3. Retrieval by an index (fully-qualified, generic, or range).
  4. Retrieval by area sweep.

These techniques are listed in descending order of efficiency. The idea behind selection logic is to perform as many selection tests as possible at the IDMS level. This minimizes the actual I/O operations required to access the necessary data. Area sweeps are the least desirable because they read through every record-type in the named area, including record-types that correspond to other segments, and they return every entry segment record. At this point, FOCUS selects those records that satisfy the test criteria in the request and discards the rest.


Top of page

x
Retrieval by IDMS Database Key

The IDMS database key method of retrieval takes precedence over the other alternatives because it is the most efficient. This method depends on the existence of two conditions:

The equality test sets the field name of the DBKEY from the entry segment in the Master File equal to specified numeric values:

IF field IS value1 [ OR value2 ...OR valuen]

The numeric value may be up to ten characters.

You can also list the values in a separate data set allocated to an arbitrary file name, and queried with:

IF field IS (ddname)

In general, it is more efficient to produce a report with DBKEY records stored in a file.

Another method is to provide an IDMS line or page number as a value in an IF test of a Dialogue Manager procedure:

IF field EQ &value 

To calculate a DBKEY value, specify the IDMS page number and the relative line number on the page in this formula:

DBKEY = (DB_PAGE * 255) + DB_LINE

DB_PAGE and DB_LINE are numeric fields with a maximum of seven and three digits respectively.

For each value specified in the IF test, the adapter calls IDMS for the record with the DBKEY using this DML command:

OBTAIN record DB-KEY IS value 

Top of page

x
Retrieval by CALC Field

If there are no selection criteria on the DBKEY for the entry segment, the second choice is CALC access. Retrieval through the CALC key, while not as efficient as DBKEY access, takes precedence over index or area sweep retrieval.

The CALC retrieval method depends on the existence of two conditions:

The IF criteria test whether the field name of the CALC key for the segment is equal to one or more fully-qualified values:

IF field IS value1 [ OR value2 ...OR valuen]

As in the DBKEY method, you can also list values for CALC fields in a separate data set and specify that data set in the IF criteria.

For each value specified in the IF criteria, the adapter calls IDMS with the following DML command:

OBTAIN CALC record 

If the Access File indicates duplicate records (CLCDUP=Y), each DML call is followed by subsequent calls:

OBTAIN DUPLICATE record 

This ensures that all appropriate records are obtained to satisfy the request.


Top of page

x
Retrieval by IDMS Index

In this section:

If there is no DBKEY or CALC key test criteria in the request, the adapter selects the index retrieval method.

Note: An index field must be defined with the FIELDTYPE=I attribute in the Master File and a corresponding index declaration must exist in the Access File. See Adapter for CA-IDMS Master Files, and Adapter for CA-IDMS Access Files for details on how to describe IDMS indexes.

Index retrieval is performed two ways using:

The first method requires at least one IF test that specifies the field name of the index field. The following IF test invokes index-based retrieval:

When two or more IF criteria in a request qualify an index on the entry-level segment, fully qualified retrieval takes precedence over generic and generic takes precedence over range. If two IF criteria are the same type, the index in the first IF test is used. All four types of IF criteria are also supported for indexes that allow duplicate values.

If the test criteria indicate index retrieval, the adapter issues the following DML command to IDMS:

OBTAIN FIRST record WITHIN setname USING value 

where:

setname

Is the name of the index set specified in the Access File.

Then, if the Access File indicates duplicate records, the adapter issues the following DML command for index sets:

OBTAIN NEXT record WITHIN setname 

The OBTAIN NEXT call is issued until all the duplicate records are retrieved. This same NEXT call is also issued if your request contains generic or range IF criteria. It is performed once for every value or range specified in the IF criteria.

Warning: If the IXORD parameter is improperly specified in the Access File, a range IF test may erroneously produce a report with one or no records.

When two or more IF criteria on index fields exist, indicate which index field is to be used for retrieval with file inversion syntax:

TABLE FILE filename.ixfieldname 

When you use the file inversion syntax for an index located in the entry (root) segment, no file inversion takes place (you are still using the same entry segment). If you want to enforce index retrieval for a given entry segment, use the second method of retrieval involving the SEQFIELD parameter.



x
Using The SEQFIELD Parameter

The second method of index retrieval does not require selection criteria and yet prohibits area sweeps on entry segments. To use this method, add the optional SEQFIELD parameter to the Access File and specify the field name of the indexed field as the value of SEQFIELD.

When your request does not contain IF criteria (for DBKEY, CALC key, or another index) and a SEQFIELD is specified for the entry segment, the adapter issues this DML command to IDMS:

OBTAIN FIRST record WITHIN setname 

where:

setname

Is the IDMS set name of the indexed field (IXSET parameter) from the Access File.

Then, the adapter issues the OBTAIN NEXT command until all records connected to the index set are retrieved:

OBTAIN NEXT record WITHIN setname 

If no sort phrase (BY or ACROSS) is specified in the request, the report is produced in ascending or descending index set order. The SEQFIELD method is recommended for indexed segments in large IDMS data sources where only a small percentage of record occurrences in a given area are the record-types defined by the segments. In such cases, IDMS resource utilization can be greatly reduced through the use of this parameter.

Warning: If the index set connection is not mandatory/automatic and this is the entry segment, some of the records in this record-type may not be accessed. In this situation, only records that are members of the index set are returned by IDMS. If this retrieval result is undesirable, you should omit the SEQFIELD parameter.


Top of page

x
Retrieval by Area Sweep

An area sweep is the least efficient method of entry-level retrieval because it reads through every record in an IDMS area to return a record of a given record-type. Despite its inefficiency, an area sweep is sometimes the only method available for retrieval.

The adapter performs an area sweep if one of the following occurs:

If one of these situations occurs, the adapter issues the following DML command to IDMS:

OBTAIN FIRST record WITHIN areaname 

where:

areaname

Is the name of the IDMS data source area specified in the Access File.

Next, the adapter issues the following command and continues to issue it until all of the records are obtained:

OBTAIN NEXT record WITHIN areaname 

Information Builders