Setting up a join logical file

 

To create a join logical file, follow this process.

  1. 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.)

  2. 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.

    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.

  3. 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.

  4. 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).

  5. Optional: Specify the following items:

    1. 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.

    2. 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.

    3. 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.

    4. Select/omit fields. In some situations, also specify the dynamic selection (DYNSLT) keyword at the file level.

    5. Neither fields.

 

Parent topic:

Setting up a join logical file

 

Related reference


Example 5: Describing fields that never appear in the record format