Enform Plus Reference Manual
Statements
Enform Plus Reference Manual—422684-001
4-28
LINK OPTIONAL Statement Considerations
See Appendix C, Links and the LINK OPTIONAL Statement Rules
for more detailed
information about links and the LINK OPTIONAL statement.
How Enform Plus Handles “Noncontributing” Record Descriptions
When your query specifications include LINK OPTIONAL statements, Enform Plus
produces target records from the logical records built for the link in a normal manner
with certain exceptions. These exceptions involve “noncontributing” record descriptions.
For a given logical record, a record description is “noncontributing” if the logical record
does not contain any data values from the data file associated with the record
description. For example, consider the following query specifications:
OPEN employee, branch;
LINK employee TO OPTIONAL branch VIA branchnum;
LIST empname, branchname;
Each logical record built for the preceding query will contain data values from the
employee records; therefore, the employee record description is said to “contribute” to
each logical record. However, some of the logical records might not contain data values
from the branch records. For these logical records, the branch record description is said
to be “noncontributing.”
Any record description that is linked to a “noncontributing” record description is also
“noncontributing.” For example, consider the following query specifications:
OPEN employee, region, order;
LINK order.salesman TO OPTIONAL employee.empnum;
LIST ordernum, empname, regname
WHERE employee.regnum = region.regnum;
If the employee record description is “noncontributing”for a given logical record, the
region record description is also “noncontributing” for that logical record.
Enform Plus handles “noncontributing” records as follows:
•
If your query specifications contain a WHERE clause, Enform Plus evaluates each
logical record to determine whether it satisfies the terms of the WHERE clause. For a
given logical record, Enform Plus ignores any term in a WHERE clause that
references a “noncontributing” record description. If several record descriptions are
“noncontributing” for a given logical record, Enform Plus ignores all terms in the
WHERE clause that reference the “noncontributing” record descriptions. If all of the
Note. When checking your query for violations of these rules, Enform Plus ignores any links
(initiated by either a LINK statement or a WHERE clause) that reference the same record
descriptions as referenced in a LINK OPTIONAL statement. In effect, Enform Plus “cancels”
any other link between the record descriptions when determining the legality of the links.
Enform Plus ignores these links only when checking for violations of the LINK OPTIONAL
rules. After Enform Plus determines that all the links in your query are legal, Enform Plus uses
each LINK statement and WHERE clause to evaluate your query.