When you define specific hierarchical representations of ADABAS structures in Master Files, you specify the order in which you want the ADABAS Interface to retrieve records. This procedure is called navigational logic and is usually part of the application program. Navigation techniques using the JOIN command also work this way.
The ADABAS Interface selects where to enter the subtree, called the point-of-entry, and the subsequent navigational processing by analyzing the tree structure defined by your Master File (or JOIN structure) and report request. The Interface determines the smallest subtree that contains all the fields needed for retrieval to produce a report.
The smallest subtree is composed of those segments that contain fields referenced by the request, plus the minimum number of additional segments required to connect all the files used in the request.
The Interface only retrieves records in segments in the referenced subtree. Within the subtree, it retrieves records that contain fields required for the report request or records that are needed to provide the correct links between report fields.
The Interface always enters a database through the root segment of the referenced subtree.
The ADABAS Interface retrieves segments from top-to-bottom, then left-to-right at each level of the hierarchy. It retrieves all unique descendant segments before any non-unique descendant segments.
This treatment of unique segments is consistent with a basic FOCUS principle: for reporting purposes (though not for updating or file organization), a unique child is logically a direct extension of its parent. This principle is an important factor in selecting a FOCUS structure that properly reflects your ADABAS file. The results of SUM and COUNT operations on fields in child segments may depend on whether they have been declared unique or non-unique. FOCUS also treats missing segments differently, depending on whether the segment is declared unique or non-unique.
If a segment is specified as unique (SEGTYPE=U or KU), FOCUS regards it as a logical extension of the parent segment. The ADABAS Interface automatically inserts default values (blanks for alphanumeric fields and zeros for numeric fields) if the unique child segment does not exist. As a result, unique segments are always present.
If a segment is specified as non-unique (SEGTYPE=S or KM), select one of three options for processing a record without descendant segments. The syntax is
SET ALL = all_option
where:
Specify SET ALL in your PROFILE FOCEXEC, in any FOCEXEC, or as a FOCUS command.
See the FOCUS for IBM Mainframe User's Manual for more information and examples of missing unique and non-unique segments.
The examples in the following sections describing the SET ALL command are based on the following structure:
The default option (SET ALL=OFF) rejects a record if the request calls for retrieval of a descendant segment and there is no descendent segment present.
For example, assume you have a file in which the parent segment is COUNTRY, which has a descendant segment named MODEL, which in turn has a descendant segment named BODYTYPE. Using the SET ALL=OFF option, the statement
COUNT BODYTYPE BY COUNTRY
does not print in the report the details of any country that did not produce at least one bodytype of a model of a car.
The ADABAS Interface displays the parent record, even if it has no descendant segments. In this case, using the SET ALL=ON option when processing the statement
COUNT BODYTYPE BY COUNTRY
FOCUS prints the names of all countries and gives a count of zero (0) bodytypes for those without descendant segments.
However, if the request has an explicit screening test on the descendant segment, the absence of any descendant segments results in test failure. For example, the request
COUNT BODYTYPE BY COUNTRY
IF MPG GT 22
excludes any country without any bodytype segments from the report.
The third option, SET ALL=PASS, allows parents without a descendant segment to pass an explicit screening test on that descendant segment. The request
COUNT BODYTYPE BY COUNTRY
lists all countries with or without bodytype segments. The request
COUNT BODYTYPE BY COUNTRY
IF MPG GT 22
includes records without any bodytype segments, and those with an MPG greater than or equal to 22.
Selectively apply SET ALL=ON by adding the ALL prefix to any field from the desired segment.
Reference the field either as a sorting field (for example, BY ALL.COUNTRY or ACROSS ALL.COUNTRY) or as a verb object (WRITE ALL.COUNTRY). As a result, the SET ALL=ON strategy is applied to any missing, immediate, non-unique descendants of the segment containing the ALL-prefixed field. The SET ALL=OFF option is in effect for all other segments.
For example, in the request
COUNT MODEL AND BODYTYPE BY ALL.COUNTRY
the SET ALL=ON option applies to the country segment and its descendant segments. Therefore, if there is a country without models (and consequently without bodytypes), the report shows that country. Any test condition on either the model or the bodytype segment nullifies the effect of the ALL prefix.
The global SET ALL settings of ON and PASS take precedence over the selective ALL prefix. The selective ALL prefix is effective only when the global setting is OFF, either explicitly or by default.
Information Builders |