Receiving Records Using File Qualifiers
To join records from several iSeries™, eServer™ i5, or System i5™ files, fields of the same type must be joined.
For example, the part number fields in the INVENTORY and SUPPLIERS files can have the same name PARTNO. To specify the desired PARTNO fields, you must specify which file contains those fields. To do so, file qualifiers are used.
A file qualifier is the character T (uppercase or lowercase) followed by a one- or two-digit number. Use a comma to delimit the file qualifier and field name. In the previous example, prefix T1. and T2. to the PARTNO field names. T1. indicates the first file of FROM, while T2. indicates the second.
Library/File (Member) | SUPPLIERS, INVENTORY |
JOIN BY | T1.PARTNO = T2.PARTNO |
SELECT | T1.PARTNO, DESCRIPTION, PRICE |
WHERE | SUPPNO = 51 |
ORDER BY | T1.PARTNO |
T1.PARTNO indicates the PARTNO fields in the SUPPLIERS file, while T2.PARTNO indicates the PARTNO fields in the INVENTORY file.
T2.DESCRIPTION, T1.PRICE, T1.SUPPNO
The following examples of joining several iSeries™, eServer™ i5, or System i5™ files describe more sophisticated techniques. You should now be familiar with the basics of how to join two files. For a more detailed explanation, refer to the following sections.