User guide

Connecting Record Descriptions to Form New Relationships
Developing an ENFORM Query
058058 Tandem Computers Incorporated 3–9
Using the LINK Statement
When you enter the LINK statement, ENFORM treats the linked record descriptions as
one logical record description. ENFORM builds record occurrences for the new logical
record description by selecting matching records from the data files associated with
the linked record descriptions. Records match when both contain the same data value
in their linking fields. For example, consider the following:
OPEN employee,region;
LINK region.manager TO employee.empnum;
Figure 3-4 shows the logical record occurrences created by the preceding LINK
statement. To build the logical record occurrences, ENFORM obtains the value of the
manager field from the first region record. ENFORM then searches the employee records
looking for a matching data value in the empnum field. If ENFORM finds a matching
value, it builds a logical record occurrence for the matching region and employee record
occurrences.
Figure 3-4. The Process of Finding Matching Values
regname manager
Region File
1
29
• • •
343
HEADQUARTERS
EAST
• • •
CANADA
empnum empname
Employee File
1
23
29
• • •
343
ROGER GREEN
JERRY HOWARD
JACK RAYMOND
• • •
ALAN TERRY
ROGER GREEN
JACK RAYMOND
• • •
ALAN TERRY
regname manager
Logical Records
1
29
• • •
343
HEADQUARTERS
EAST
• • •
CANADA
empnum empname
1
29
• • •
343
LINK Appears to Create
New Logical Records
In Figure 3-4, each data value in the manager field matches a data value in the empnum
field. Figure 3-5 shows a diagram of the new logical record occurrences built when a
matching value ( empnum = 29) is missing and the same LINK statement is issued.