This topic discusses the rules for specifying key fields in join
logical files.
If you specify key fields in a join logical file, the following
rules apply:
- The key fields must exist in the primary physical file.
- The key fields must be named in the join record format in the logical
file in positions 19 through 28.
- The key fields cannot be fields defined as neither fields (N specified
in position 38 for the field) in the logical file.
The following example illustrates the rules for key fields:
JLF
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A R JOINREC JFILE(PF1 PF2)
A J JOIN(PF1 PF2)
A JFLD(NBR NUMBER)
A JFLD(FLD3 FLD31)
A FLD1 RENAME(F1)
A FLD2 JREF(2)
A FLD3 35 N
A NAME
A TELEPHONE CONCAT(AREA LOCAL)
A K FLD1
A K NAME
A
PF1
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A R REC1
A NBR 4
A F1 20
A FLD2 7 2
A FLD3 40
A NAME 20
A
PF2
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A R REC2
A NUMBER 4
A FLD2 7 2
A FLD31 35
A AREA 3
A LOCAL 7
A
The following fields
cannot be key fields:
- Nbr (not named in positions 19 through 28)
- Number (not named in positions 19 through 28)
- F1 (not named in positions 19 through 28)
- Fld31 (comes from a secondary file)
- Fld2 (comes from a secondary file)
- Fld3 (is a neither field)
- Area and Local (not named in positions 19 through 28)
- Telephone (is based on fields from a secondary file)