Descendant ADABAS Records
The access strategy used to retrieve descendant records in a subtree depends on the
Access File attributes specified for a given segment and the SEGTYPE attribute in the
Master File (or the SEGTYPE created on the cross-referenced segment as the result of a
JOIN). In some cases, the selection criteria in a request further affect access strategy for
descendant segments.
Descendant records are related to their parents by a field or GROUP in the parent that
corresponds to a field or GROUP in the descendant. This relationship is set up either in
the Access File using the KEYFLD/IXFLD pair or through the host field/cross-referenced
field combination in a JOIN.
The most appropriate access strategy is selected based on the value of CALLTYPE of the
descendent segment in the Access File. The three basic strategies used to obtain
descendant records are:
- Retrieval of descendant records through Read Logical calls using a starting value.
- Retrieval of descendant records through simple FIND calls.
- Retrieval of descendant records through complex FIND calls.
The CALLTYPE attribute, together with the KEYFLD/IXFLD attributes, the SEGTYPE, and the
TABLE request, are the determining factors in the way descendant data is retrieved.
Read Logical Calls Using a Starting Value
The ADABAS Interface constructs Read Logical (L3) calls for related descendant records of
a parent when the following conditions are met:
- The Access File contains CALLTYPE=RL for that segment.
- The IXFLD or JOIN to field is described as TYPE=DSC or TYPE=SPR in the Access File.
- No other selection criteria on inverted lists for this segment have selection on a descriptor with TYPE=NOP.
Read Logical processing is performed on a single inverted list only. The steps the ADABAS
Interface performs to complete a Read Logical call using a starting value are:
- The ADABAS Interface constructs a Read Logical (L3) call with the value of the KEYFLD from the parent segment for the IXFLD inverted list. This call retrieves the first record whose value in the inverted list is equal to or greater than the value of the KEYFLD.
- For unique descendants, no additional retrieval is performed on the descendant segment for any given parent. (For an embedded cross-referenced segment, the SEGTYPE is U or KU or the segment was the cross-referenced segment in a unique JOIN.)
- For non-unique descendants, subsequent retrieval for the entry segment is completed by issuing the same Read Logical call with the User Control Block unmodified. The records are returned in ascending value of the inverted list.
The Interface terminates retrieval when one of the following conditions is met:
- The value of the inverted list is greater than the value of the KEYFLD.
- ADABAS issues a response code indicating end-of-list.
- The FOCUS RECORDLIMIT or READLIMIT is reached.
Simple FIND Calls
The ADABAS Interface constructs a simple FIND (S1) call, using a single inverted list, to
obtain related descendant records for a parent when one of the following conditions
exists:
- The Access File contains CALLTYPE=FIND (or omits CALLTYPE) and the request contains no selection criteria on the descendant segment.
- The Access File contains CALLTYPE=FIND (or omits CALLTYPE) and the request contains selection criteria on the descendant segment and the descendant is unique. (For an embedded cross-referenced segment, the SEGTYPE is U or KU or the segment was the cross-referenced segment in a unique JOIN.)
- For any value of CALLTYPE, IXFLD is described with TYPE=NOP in the Access File and the request contains no selection criteria on the descendant segment.
The steps the ADABAS Interface and ADABAS perform to complete simple FIND calls
against descendant segments are:
- The ADABAS Interface constructs a FIND (S1) call with the value of the KEYFLD from the parent segment for the inverted IXFLD list.
- For unique descendants, ADABAS returns the record on the FIND call; no 'H' command is issued to ADABAS. Only one call will be issued, and only the first instance of data will be returned.
- For non-unique descendants, the ADABAS Interface calls ADABAS with an 'H' in Command Option 1, which instructs ADABAS to store the resulting list of ISNs in the ADABAS work area.
- ADABAS constructs a complete list of ISNs for every record related to the parent record in the work area. This list is sorted in ascending ISN order.
- The ADABAS Interface issues a Read ISN (L1) call to retrieve the first record from the ADABAS work area which matches the selection criteria.
If the descendant is not unique, subsequent retrieval of records for this descendant
segment is completed using the Read ISN (L1) call issued against the ISN list held by
ADABAS. L1 calls are issued until one of the following occurs:
- ADABAS issues a response code indicating end-of-list.
- The FOCUS RECORDLIMIT or READLIMIT is reached.
Complex FIND Calls
The ADABAS Interface constructs a complex FIND (S1) call, using several inverted list
structures, to obtain related descendant records for a parent when one of the following
conditions is met:
- The Access File contains CALLTYPE=FIND for that segment (or omits CALLTYPE) and the descendant is non-unique. (For an embedded cross-referenced segment, the SEGTYPE is S or KM, or the segment was the cross-referenced segment in a non-unique JOIN.) The report request contains one or more selection criteria on the descendant segment.
- The Access File contains any value of CALLTYPE. The descendant is non-unique. (For an embedded cross-referenced segment, the SEGTYPE is S or KM, or the segment was the cross-referenced segment in a non-unique JOIN.) The request contains one or more selection criteria on the descendant segment, one of which is on a descriptor, or the IXFLD is described as TYPE=NOP in the Access File.
The steps the ADABAS Interface and ADABAS perform to complete a complex FIND call
are:
- The ADABAS Interface constructs a FIND (S1) call with the value of the KEYFLD from the parent segment using the inverted IXFLD list, in addition to all other selection criteria on inverted lists from the request.
- For non-unique descendants, the ADABAS Interface calls ADABAS with an 'H' in Command Option 1, which instructs ADABAS to store the resulting list of ISNs in the ADABAS work area.
- ADABAS constructs an ISN list for each inverted list specified and merges these lists into a final list of ISNs which match all of the selection criteria in the call. This list is kept in the ADABAS work area and is sorted in ascending ISN order.
- The ADABAS Interface then issues a Read ISN (L1) call to retrieve the first record from the ADABAS work area which matches the selection criteria.
Subsequent retrieval of records for this descendant segment is done through the Read
ISN (L1) call issued against the ISN list held by ADABAS. L1 commands are issued until
one of the following occurs:
- ADABAS issues a response code indicating end-of-list.
- The FOCUS RECORDLIMIT or READLIMIT is reached.