Enform Plus Reference Manual
Links and the LINK OPTIONAL Statement Rules
Enform Plus Reference Manual—422684-001
C-10
Examples of Valid Links
A sketch of these links appears as follows:
employee region
The link initiated by the WHERE clause might appear to violate rule 1. Remember,
however, that when Enform Plus checks the validity of a link, a LINK OPTIONAL
statement “cancels” any two-directional link between the same record descriptions.
Enform Plus does use this two-directional link when evaluating the query.
The following query specifications contain two LINK OPTIONAL statements:
OPEN employee, order, odetail;
LINK employee.empnum TO OPTIONAL order.salesman;
LINK order TO OPTIONAL odetail VIA ordernum;
LIST empname, order.ordernum, partnum, quantity;
A sketch of these links appears as follows:
employee order
odetail
Initially, you might assume that these links violate rule 2 because odetail appears on
the right side of the first as well as the second LINK OPTIONAL statement, but this is
not the case. Rule 2 states that a record description appears on the right side of more
than one LINK OPTIONAL statement only if a two-directional link exists between it and
another record description on the right side of a LINK OPTIONAL statement. Because
the one-directional LINK OPTIONAL statement links order and odetail,
odetail appears only on the right side of the second LINK OPTIONAL statement.
The following query specifications show a valid method of generating a “double”
exception report:
OPEN employee, region, jobs;
LINK employee TO OPTIONAL region VIA regnum;
LINK employee TO OPTIONAL branch VIA branchnum;
LIST empname, employee.regnum, employee.branchnum
SUPPRESS WHERE employee.regnum = region.regnum OR
employee.branchnum = branch.branchnum;
A sketch of these links appears as follows:
employee region
branch