This topic shows how to set up a join logical file.
To set up a join logical file, follow these steps:
- Find the names of all the physical file fields you want in the
logical file record format. (You can display the fields contained in files
using the Display File Field Description (DSPFFD) command.)
- Describe the fields in the record format. Write the
field names in a vertical list. This is the start of the record format for
the join logical file.
Note: You can specify the field names in any order.
If the same field names appear in different physical files, specify the name
of the physical file on the JREF keyword for those fields. You can rename
fields using the RENAME keyword, and concatenate fields from the same physical
file using the CONCAT keyword. A subset of an existing character, hexadecimal,
or zoned decimal field can be defined using the SST keyword. The substring
of a character or zoned decimal field is a character field, and the substring
of a hexadecimal field is also a hexadecimal field. You can redefine fields:
changing their data type, length, or decimal positions.
- Specify the names of the physical files as parameter values on
the JFILE keyword. The first name you specify is the primary file.
The others are all secondary files. For best performance, specify the secondary
files with the least records first after the primary file.
- For each secondary file, code a join specification. On
each join specification, identify which pair of files are joined (using the
JOIN keyword; optional if only one secondary file), and identify which fields
are used to join the pair (using the JFLD keyword; at least one required in
each join specification).
- Optional: Specify the following items:
- The JDFTVAL keyword. Do this if you want to return a record for each record
in the primary file even if no matching record exists in a secondary file.
- The JDUPSEQ keyword. Do this for fields that might have duplicate values
in the secondary files. JDUPSEQ specifies on which field (other than one of
the join fields) to sort these duplicates, and the sequence that should be
used.
- Key fields. Key fields cannot come from a secondary file. If you omit
key fields, records are returned in arrival sequence as they appear in the
primary file.
- Select/omit fields. In some situations, you must also specify the dynamic
selection (DYNSLT) keyword at the file level.
- Neither fields.