JFLD (Joined Fields) keyword—join logical files only
You can use this join-level keyword to identify the from and to fields whose values are used to join physical files in a join logical file. These fields are both referred to as join fields.
JFLD(from-field-name to-field-name)
The join fields must correspond to fields in the physical files identified on the JOIN keyword for this join specification. The name you specify on the JFLD keyword must be the same as the name specified in the physical file unless it was renamed in the join logical file. If you do not specify a JOIN keyword, then the JFILE keyword is used.
This keyword is valid only for join logical files.
At least one JFLD keyword is required for each join specification. A join specification is identified by J in position 17. Because at least one join specification is required in a join logical file, you must have at least one JFLD keyword specified in a join logical file.
These fields need not also be specified as fields in the record format for a join logical file.
To specify additional join fields to use when joining physical files, specify more than one JFLD keyword.
The field names you specify on the JFLD keyword must be specified either at the field level in the join record format or in one of the physical files, which are specified on the JFILE keyword.
- Fields specified in the join logical file at the field level in positions
19 through 28. Note: Fields that specify the CONCAT, RENAME, or SST keyword are valid as join fields; fields that are specified on CONCAT, RENAME, or SST keyword cannot be join fields.
- Fields in the physical file specified on the JOIN keyword.
- The from field must be found in the from file specified on the JOIN keyword.
- The to field must be found in the to file specified on the JOIN keyword.
- Join fields are not required to be defined in the join record format.
- From and to fields must have the same field attributes (length,
data type, and decimal positions) but need not have the same name. When the
joined fields in the physical files have different definitions, you must redefine
one or both fields. If you redefine fields, there is a possibility of data
conversion errors.Note: Character fields need not have the same length. The shorter join field is padded with blanks to equal the length of the longer join field.
- In a single join specification, the total length of fields specified as to fields on the JFLD keyword and fields specified on the JDUPSEQ keyword can be up to 120 bytes.
- Binary character fields can be joined only with other binary character fields.
Examples
The following examples show how to specify the JFLD keyword.
Example 1
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R JREC JFILE(PF1 PF2)
00020A J JOIN(PF1 PF2)
00030A JFLD(NAME1 NAME2)
A
In the join logical file, the JFLD keywords specify that NAME1 in physical file PF1 is used to join to NAME2 in physical file PF2.
Example 2
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R JREC JFILE(PF1 PF2)
00020A J JOIN(PF1 PF2)
00030A JFLD(NAME1 NAME2)
00040A JFLD(ADDR1 ADDR2)
A
In the join logical file, the JFLD keywords specify that NAME1 and ADDR1 in physical file PF1 are used to join to NAME2 and ADDR2 in physical file PF2.