DRDA examples

This example application for distributed relational database use is written in RPG/400®, COBOL/400, Java™, and ILE C programming languages.

Example: Business requirement for distributed relational database

The application for the distributed relational database in this example is parts stock management in an automobile dealer or distributor network.

This program checks the level of stock for each part in the local part stock table. If this is below the re-order point, the program then checks on the central tables to see whether there are any existing orders outstanding and what quantity has been shipped against each order.

If the net quantity (local stock, plus orders, minus shipments) is still below the re-order point, an order is placed for the part by inserting rows in the appropriate tables on the central system. A report is printed on the local system.

Technical notes

Commitment control

This program uses the concept of local and remote logical units of work (LUW). Because this program uses remote unit of work, it is necessary to close the current LUW on one system (COMMIT) before beginning a new unit of work on another system.

Cursor repositioning

When an LUW is committed and the application connects to another database, all cursors are closed. This application requires the cursor reading the part stock file to be re-opened at the next part number. To achieve this, the cursor is defined to begin where the part number is greater than the current value of part number, and to be ordered by part number.

Note: This technique will not work if there are duplicate rows for the same part number.