Enform Plus Reference Manual

Links and the LINK OPTIONAL Statement Rules
Enform Plus Reference Manual422684-001
C-2
Links Initiated by a LINK OPTIONAL Statement
Links Initiated by a LINK OPTIONAL Statement
A link initiated by a LINK OPTIONAL statement is a one-directional link. Therefore, a
one-way dependency condition exists where the record occurrences associated with the
record description on the right of the statement depend upon the record occurrences
associated with the record description on the left of the statement. For example, if you
specify:
LINK apple TO OPTIONAL orange VIA seeds;
the following is true of the logical records built for the link:
A given apple record occurrence appears in the logical records even if its linking
field value does not match a linking field value in an orange record occurrence.
Thus, an apple record occurrence does not depend on an orange record
occurrence.
A given orange record occurrence appears in the logical records only if its linking
field value matches the linking field value of an apple record occurrence. Thus, an
orange record occurrence depends upon an apple record occurrence.
A one-directional link established by the LINK OPTIONAL statement can be sketched
as follows:
record-description-1 record-description-2
where the arrowhead points at the dependent record description.
Links Initiated by a WHERE Clause
A link initiated by a WHERE clause is a two-directional link. Before you can fully
understand when a WHERE clause establishes a link, you must first understand what
Enform Plus does when a WHERE clause appears in a query.
How Enform Plus Handles a WHERE Clause
When you use a WHERE clause, Enform Plus converts the WHERE clause into
conjunctive normal form. This means that Enform Plus takes the logical expression in
the WHERE clause and converts it into one or more “terms.” Each term consists of a
logical expression that is connected to another logical expression by the Boolean
operator AND. For example, consider the WHERE clause in the following query:
OPEN fruit, peach;
LIST BY fruit.color, peach.variety;
WHERE fruit.fuzz = peach.fuzz;
The logical expression in this WHERE clause is already in conjunctive normal form. The
single term in this WHERE clause is:
fruit.fuzz = peach.fuzz one term