Example 5: Describing fields that never appear in the record format
Neither fields (where N is specified in position 38) can be used in a join logical file for neither input nor output. Neither fields are not included in the record format. This example shows how to describe such fields that never appear in the record format.
Programs using the join logical file cannot see or read neither fields. Neither fields are not included in the record format. Neither fields cannot be key fields or used in select/omit statements in the joined file. You can use a neither field for a join field (specified at the join specification level on the JFLD keyword) that is redefined at the record level only to allow the join operation, but is not needed or wanted in the program.
In the following example, the program reads the descriptions, prices, and quantity on hand of parts in stock. The part numbers themselves are not wanted except to bring together the records of the parts. However, because the part numbers have different attributes, at least one must be redefined.
The join logical file (JLF) has fields Description, Price, and Quantity on hand. Physical file 1 (PF1) has Description and Part number, while physical file 2 (PF2) has Part number, Price, and Quantity on hand. The data description specifications (DDS) for these files are shown as follows:
JLF |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A R JOINREC JFILE(PF1 PF2) A J JOIN(PF1 PF2) A JFLD(PRTNBR PRTNBR) A PRTNBR S N JREF(1) A DESC A PRICE A QUANT A K DESC APF1 |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A R REC1 A DESC 30 A PRTNBR 6P 0 A
PF2 |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A R REC2 A PRTNBR 6S 0 A PRICE 7 2 A QUANT 8 0 A
In PF1, the Prtnbr field is a packed decimal field; in PF2, the Prtnbr field is a zoned decimal field. In the join logical file, they are used as join fields, and the Prtnbr field from PF1 is redefined to be a zoned decimal field by specifying an S in position 35 at the field level. The JREF keyword identifies which physical file the field comes from. However, the field is not included in the record format; therefore, N is specified in position 38 to make it a neither field. A program using this file would not see the field.
In this example, a sales clerk can type a description of a part. The program can read the join logical file for a match or a close match, and display one or more parts for the user to examine, including the description, price, and quantity. This application assumes that part numbers are not necessary to complete a customer order or to order more parts for the warehouse.
Parent topic:
Setting up a join logical file