The following rules illustrate the automation of another common task: Determine that the sum of the numbers listed in a vertical column of a report equals the total for that column printed in the report. A slightly modified copy (Figure 387) of the inventory report used for Rule 1A is used to demonstrate how this task is accomplished.
Figure 387 Sample Inventory Report (2)
INVENTORY REPORT
================
WAREHOUSE NO: 1001 DEPARTMENT: 100 – FINAL ASSEMBLY SHOP
==== ===========================
SHELF QNTY QNTY QNTY QNTY IN TOTAL PART
ITEM NO. DESCRIPTION LIFE UNIT AVAIL ORDER PROCESS QNTY CLASS
=========== ================ ===== ==== ======= ===== ======= ======= ===========
1233-781-21 RIVET D. 0.1 ACR NONE KG 1,100.00 250.00 350.00 FLOOR STOCK
1233-781-25 RIVET D. 0.5 ACR NONE KG 1,500.00 500.00 1000.00 FLOOR STOCK
1233-781-27 RIVET D. 0.7 ACR NONE KG 2,100.00 100.00 200.00 FLOOR STOCK
2201-800-01 METAL O RING 0.1 NONE EA 34.00 34.00 FLOOR STOCK
2201-800-22 METAL O RING 2.2 NONE EA 20.00 30.00 50.00 FLOOR STOCK
2201-800-27 METAL O RING 2.7 NONE EA 35.00 35.00 FLOOR STOCK
2274-711-21 WASHER D. 0.1 NONE KG 10.50 10.50 21.00 FLOOR STOCK
2274-711-25 WASHER D. 0.5 NONE KG 450.00 400.00 850.00 FLOOR STOCK
2274-711-27 WASHER D. 0.7 NONE KG 100.00 100.00 FLOOR STOCK
2274-811-21 BOLT 1/8 NONE KG 50.00 25.00 75.00 FLOOR STOCK
=================================================================================
TOTALS: 2,114.50 1475.50 3590.00
Each rule contains two independent WHEN statements. The first WHEN statement uses the presence of unique punctuation (a hyphen in column 6) to identify detail lines. Each "detail" line lists information about a specific item in the warehouse. It is identified by a catalog number on the left side of the line. Every catalog number has the same structure (XXXX-XXX-XX). Therefore, every detail line has a hyphen in column 6.
The DO EXTRACT statement automatically sums the extracted quantities when parameter TYPE is set to SU (sum). The DO EXTRACT statement uses the BFNUM process to convert formatted numbers (for example, with commas) for mathematical comparisons.
The second WHEN statement identifies a total line and extracts totals from that line (+0). This process is very similar to that of Rule 1.
If the calculated sum of the numbers extracted from the column does not equal the total for that column contained in the report, appropriate notification is sent to specified locations using the Shout facility.
Parent Topic |