Enform Plus Reference Manual

Statements
Enform Plus Reference Manual422684-001
4-26
Duration of Link Established by LINK or LINK
OPTIONAL Statement
Duration of Link Established by LINK or LINK OPTIONAL Statement
When you use either the LINK statement or the LINK OPTIONAL statement, you
establish a link that exists for the duration of the Enform Plus session. You can clear
such a link by entering one of the following:
A CLOSE statement for one of the record descriptions
A DELINK statement for the link
A DICTIONARY statement or a ?DICTIONARY command that clears the entire
internal table; when you clear the internal table, you also clear all links
Enform Plus allows you to specify up to 32 LINK or LINK OPTIONAL statements. If
you include the LINK OPTIONAL statement in your query specifications, be sure to
follow the rules described later in this section under LINK OPTIONAL Statement
Considerations on page 4-26.
LINK Statement Considerations
When you use a single LINK statement, Enform Plus builds a set of logical records by
searching through the data files associated with the linked record descriptions. A record
from one data file becomes part of the set of logical records only if the content of its
linking field matches the content of the linking field in a record in the other data file.
When you use a LINK statement, you indicate that the values of the linking fields must
be equal. (If you want to indicate inequality for the values of the linking fields, you must
use a WHERE clause.) A single LINK statement is equivalent to the following form of
the WHERE clause:
WHERE qualified-field-name1 EQ qualified-field-name2,
When you use a LINK statement, the order in which you enter the record description
names is unimportant. For example:
LINK employee.empnum TO branch.manager;
is the same as:
LINK branch.manager TO employee.empnum;
LINK OPTIONAL Statement Considerations
When you establish a link by specifying the LINK OPTIONAL statement, you preserve
all of the information from the data file whose record description is specified on the left
side of the statement. You preserve this information because Enform Plus builds the
logical records for such a link in a different manner than it does for a link established by
a LINK statement. For example, suppose that you entered the following LINK
OPTIONAL statement:
LINK employee TO OPTIONAL branch VIA branchnum;