Join logical files are similar to simple logical files both in concept and in manipulation. However, record structure and update capability have some differences that are worth analyzing.
Join logical files can combine fields from several physical files in a single record format. The system only requires that the physical files have equivalent fields in each file. The fields must also have equal values through which to join the two records.
For example, consider the following case. You have three files: COM (customer order master) shown in Table 20.1, COLI (customer order line items) shown in Table 20.2, and IM (item master) shown in Table 20.3.
COORD# | Customer order number |
COCUST | Customer number |
COPO# | Purchase order number |
LIORD# | Customer order number |
LIITEM | Item number |
LIQTY | Quantity ordered |
IMITEM | Item number |
IMDESC | Description |
IMCOST | Unit cost |
Through a join logical, you can combine all fields into a single record format (a single file containing all the fields), because COM and COLI have the order number in common, and COLI and IM have the item number in common. The join logical would therefore have the fields as shown in Table 20.4:
JFORD# | Customer order number |
JFCUST | Customer number |
JFPO# | Purchase order numeber |
JFITEM# | Item number |
JFQTY | Quantity ordered |
JFDESC | Description |
JFCOST | Unit cost |
All the information shown in Table 20.4 would be contained in a single join logical file. The next time you need to create a program to print a report based on these fields, you would have to process only one file, the join logical.
Join logicals cannot be used to update the data fields they have joined. Join logical files can only be used to read data. If you want to change the contents of any of the fields in the join logical files record, you must perform the update through the appropriate physical file.