To retrieve a customer description to be displayed when processing an order:
When the I/O module for the order file is made operational the Predetermined Join Field customer description will be available in the same way as a virtual field when coding RDML without having to include any type of fetch from the customer file.
Where a code file is repeatedly accessed for the same information an appropriate KEEP LAST value will reduce the number of I/Os performed.
To retrieve the descriptions of the 'from' and 'to' warehouses in a stock transfer file:
To retrieve the total value and number of lines in an order when displaying the order header details:
When the order file is made operational the total value and line count fields are available in the RDML editor along with the order fields without coding any reference to the order line file.
To calculate a price for each line of an order using a Predetermined Join Field and a virtual field:
By including the product price (Predetermined Join Field) and product value (virtual field) when defining a select command in RDML, the arithmetic will be performed without any additional RDML code.
Although the Predetermined Join Field processing is coded within the I/O module the source files are only accessed when one of the Predetermined Join Fields on a particular access route is used in the function calling the I/O module.
This means that, unless the Predetermined Join Field is explicitly specified in the I/O operation (for example FETCH or SELECT), it would not be retrieved and calculated from the source file (not even when it is derived from a Virtual Field).
If the function has been DBOPTIMIZED the Predetermined Join Field processing is included in the I/O module logic which is embedded in the function.
If the file to be accessed by the access route is defined as a high speed table the source information for the Predetermined Join Fields will be retrieved from the high speed table thereby reducing I/Os.
Warning: Read the appropriate sections on high speed tables before attempting to use them.
When defining Predetermined Join Fields careful thought should be given to their use. They are very efficient for looking up code files for descriptions when used with a KEEP LAST value or accessing a high speed table, but if they are used excessively each file accessed will affect the number of files used in the I/O module and DBOPTIMIZSED functions (see Using *DBOPTIMIZE / *DBOPTIMIZE_Batch for a further explanation). Also they could greatly increase the number of I/Os performed by the I/O module where there are 1 to many relationships.
As a guide, do not access more than 10 to 15 files.