Figure 59, Figure 60, and Figure 61 show how to specify the JOIN keyword.
Figure 59. Specifying the JOIN Keyword (Example 1)
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R RECORD1 JFILE(PFA PFB PFC)
00020A J JOIN(PFA PFB)
00030A JFLD(NAME1 NAME2)
00040A J JOIN(PFA PFC)
00050A JFLD(NAME1 NAME3)
00060A NAME1
A
In Figure 59, PFA is joined to PFB and also to PFC.
Figure 60 shows how to specify JOIN using relative file numbers.
Figure 60. Specifying the JOIN Keyword (Example 2)
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R RECORD1 JFILE(PFA PFB PFC)
00020A J JOIN(1 2)
00030A JFLD(NAME1 NAME2)
00040A J JOIN(1 3)
00050A JFLD(NAME1 NAME3)
00060A NAME1
A
Figure 60 is equivalent to Figure 59. PFA is the first physical file specified on the JFILE keyword and has relative file number 1. PFB and PFC are the second and third files specified on the JFILE keyword and have relative file numbers 2 and 3, respectively.
Figure 61 shows the order of associated physical files.
Figure 61. Specifying the JOIN Keyword (Example 3)
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R J3 JFILE(VENDORS PARTS PARTWARE +
00020A WAREHOUSE
(1)
00030A J JOIN(1 2) (2)
00040A JFLD(VNBR VNUM)
00050A J JOIN(2 3) (3)
00060A JFLD(PNBR PNBR)
00070A J JOIN(3 4) (3)
00080A JFLD(WNBR WNBR)
00090A VNAME
00100A VAD1
00110A VAD2
00120A PNBR JREF(2)
00130A WNBR JREF(4)
00140A BIN
00150A QOH
A
The join logical file in Figure 61 is based on four physical files. The VENDORS file, which is specified first on the JFILE keyword, is the primary file and has relative file number 1. The PARTS, PARTWARE, and WAREHOUSE files, which are secondary files, have relative file numbers 2, 3, and 4, respectively.
Notice the pattern of numbers specified on the JOIN keywords:
J JOIN(VENDORS PARTS) J JOIN(PARTS PARTWARE) J JOIN(PARTWARE WAREHOUSE)
| Note: | A file can be specified as a from file more than once. For
example, the parameters on the JOIN keywords above could have been specified
as follows:
J JOIN(1 2) J JOIN(2 3) J JOIN(2 4) |
However, a file can be specified as a to file only once.