Enform Plus Reference Manual

Links and the LINK OPTIONAL Statement Rules
Enform Plus Reference Manual422684-001
C-8
Examples of Invalid Links
The preceding query specifications are effectively the same as the first query
specifications. These specifications contain invalid links because the WHERE clause links
order back to employee due to the transitive property of links.
The following query specifications violate rule 2:
OPEN employee, region;
OPEN employee1 AS COPY OF employee;
OPEN employee2 AS COPY OF employee;
LINK employee1 TO OPTIONAL region VIA regnum;
LINK employee2 TO OPTIONAL region VIA regnum;
LIST employee1.empname, employee.empname, regname;
A sketch of these links appears as follows:
employee1
region
employee2
The preceding query specifications violate rule 2 because region appears on the right
side of more than one LINK OPTIONAL statement.
The following query specifications violate rule 2 because both order and region
appear on the right side of two LINK OPTIONAL statements due to the transitive
properties of links:
OPEN employee, region, customer, order;
LINK employee TO OPTIONAL region VIA regnum;
LINK customer TO OPTIONAL order VIA custnum;
LINK order.salesman TO region.manager;
LIST empname, regname, custname;
Symbolically, these links appear as follows:
employee region
customer order
The links in the preceding query are invalid because the LINK statement specifies a two-
directional link between two record descriptions that appear on the right side of LINK
OPTIONAL statements.
The following query specifications, which attempt to generate a “double” exception
report, violate rule 2:
OPEN employee, region, branch;
LINK employee TO OPTIONAL region VIA regnum;
LINK employee TO OPTIONAL branch VIA branchnum;
LIST empname, employee.regnum, employee.branchnum