In this section: |
When a record in a parent segment is retrieved, the corresponding records in the descendant segment are retrieved. If descendant records do not exist, the processing of the parent record depends on whether the descendant segment is unique or non-unique.
For a unique descendant segment with a missing record, a temporary record is created to replace the missing record. The temporary record contains fields with default values, blanks for alphanumeric fields and zeros for numeric fields.
For example, an EMPLOYEE segment with the field EMP_NAME has a unique descendant OFFICE segment with the field OFFICE_CITY. The field OFFICE_CITY indicates the location of an employee's office. Gary Smith does not work out of an office location, so he has no OFFICE record. In this situation, all reports that refer to OFFICE_CITY display blank spaces for the entry GARY SMITH.
For a non-unique descendant segment with a missing record, the results depend on how the ALL parameter is set:
SET ALL = {ON|OFF}
where:
The parent record is processed provided that there are no screening conditions on fields in the descendant segment. Missing data is usually indicated on the report by the default NODATA character (.). For information about overriding the NODATA default, see your FOCUS documentation.
The parent instance is rejected and the next parent instance is retrieve. OFF is the default value.
Note: SET ALL = PASS is not supported by the adapter.
The EMPLOYEE segment has a non-unique descendant segment that contains dental claim records. With SET ALL = OFF, a request that prints employee names and dentist names omits employees that have no dental claims:
SET ALL = OFF TABLE FILE EMPFULL PRINT EMP_NAME DENTIST_NAME IF DEPT_NAME EQ 'EXECUTIVE ADMINISTRATION' OR 'COMPUTER OPERATIONS' END
The output is:
EMP_NAME DENTIST_NAME -------- ------------ HERBERT CRANE DR PEPPER HENRIETTA HENDON SAL SARDONICUS
With SET ALL = ON, a request that prints dentist names and employee names prints the names of all employees, even those without dental claims. The report output displays the NODATA symbol for the field from the missing descendant segment:
SET ALL = ON TABLE FILE EMPFULL PRINT EMP_NAME DENTIST_NAME IF DEPT_NAME EQ 'EXECUTIVE ADMINISTRATION' OR 'COMPUTER OPERATIONS' END
The output is:
EMP_NAME DENTIST_NAME -------- ------------ HERBERT CRANE DR PEPPER JANE FERNDALE . GEORGE FONRAD . ROBIN GARDNER . DOUGLAS KAHALLY . TERENCE KLWELLEN . SANDY KRAAMER . HERBERT LIPSICH . NANCY TERNER . HENRIETTA HENDON SAL SARDONICUS THEMIS PAPAZEUS . JOHN RUPEE . ROBBY WILDER .
When a request contains an IF test on the descendant (dental) segment, parent (employee) records are omitted if the descendant segment fails the IF test. Only Herbert Crane has a dental claim for tooth number 99:
SET ALL = ON TABLE FILE EMPFULL PRINT EMP_NAME DENTIST_NAME IF DEPT_NAME EQ 'EXECUTIVE ADMINISTRATION' OR 'COMPUTER OPERATIONS' IF TOOTH_NUMBER EQ 99 END
The output is:
EMP_NAME DENTIST_NAME -------- ------------ HERBERT CRANE DR PEPPER
If the value for SET ALL is OFF, you can still apply the effect of the ON setting to specific segments. To do this, add the ALL prefix to one of the parent segment fields in your request. The ALL prefix causes records in that segment to be processed even if they have missing descendants. Like the SET ALL parameter, the processing depends on whether IF criteria exist for the descendant record fields.
Note: The IF criteria provision affects only immediate descendants. In cases where descendants are missing their descendant record occurrences, the parent record occurrence is rejected.
For example, the following request displays people who have no dental claim records. However, it will not display people who have dental claim records and no corresponding dental service records.
SET ALL = OFF TABLE FILE EMPFULL PRINT ALL.EMP_NAME DENTIST_NAME SERVICE_DATE IF DEPT_NAME EQ 'EXECUTIVE ADMINISTRATION' OR 'COMPUTER OPERATIONS' END
The output is:
EMP_NAME DENTIST_NAME SERVICE_DATE -------- ------------ ------------ HERBERT CRANE DR PEPPER 19800916 HERBERT CRANE DR PEPPER 19800916 JANE FERNDALE . . GEORGE FONRAD . . ROBIN GARDNER . . DOUGLAS KAHALLY . . TERENCE KLWELLEN . . SANDY KRAAMER . . HERBERT LIPSICH . . NANCY TERNER . . HENRIETTA HENDON SAL SARDONICUS 19770502 THEMIS PAPAZEUS . . JOHN RUPEE . . ROBBY WILDER . .
The ALL prefix is only effective when the SET ALL value is OFF.
Information Builders |