Skip to content

BB715 RPG36

The BB715.rpg36.txt is an RPG program (for IBM System/36 or AS/400) called by the BB715.ocl36.txt OCL program to generate the final "Daily Requirements Report." It processes sorted order data from BBORDR (mapped to BB715S), combines it with inventory data from various files, and produces a formatted report via the LIST printer file. Below, I’ll explain the process steps, business rules, tables (files) used, and external programs called, incorporating insights from the provided OCL and related RPG programs (BB715P, BB713, BB714, BB714A).

Process Steps of the RPG Program

The BB715 RPG program reads sorted order data, retrieves additional data from inventory and reference files, calculates daily and weekly quantities, and generates a report with tank inventory and availability. Due to the truncated code (27,234 characters missing), I’ll focus on the provided specifications, output definitions, and context from the OCL and related programs, making reasonable inferences for the missing logic.

  1. Program Initialization:
  2. Header (H-spec): Line 0002 defines the program name (BB715) and page length (P064).
  3. File Definitions (F-spec):
    • BBORDR: Primary input file (530 bytes, disk, mapped to BB715S in OCL, Line 0004).
    • BICONT: Input file (256 bytes, indexed with 2 keys, disk, Line 0005).
    • GSTABL: Commented out, replaced by GSPROD (Line JK02).
    • INLOC: Input file (512 bytes, indexed with 5 keys, disk, Line 0007).
    • INTKRY, INTKRW: Input files (128 bytes, indexed with 25 and 21 keys, externally described, disk, Line 0006).
    • GSCTUM: Input file (64 bytes, indexed with 12 keys, disk, Line 0010).
    • INCHRT: Input file (512 bytes, indexed with 9 keys, disk, Line 0008).
    • GSCNTR1: Input file (512 bytes, indexed with 3 keys, disk, Line JK01).
    • GSPROD: Input file (512 bytes, indexed with 6 keys, disk, Line JK02).
    • LIST: Output printer file (164 bytes, Line 0008).
  4. Array Definitions (E-spec):
    • DAY: 1x7 array, 3 characters, holding day names (e.g., 'THU', 'FRI', Lines 0009, post-0419).
    • DYN: 5x3 array for day names in report headers (Line 0011).
    • DTE: 5x4 array for MMDD dates (Line 0012).
    • DT8: 5x8 array for CYMD dates (Line 0013).
  5. Input Definitions (I-spec):

    • BBORDR (Lines 0014–0031):
    • BDDEL (1): Delete flag.
    • BDCO (2–3): Company number (level break L7).
    • BDORD# (4–9): Order number.
    • BDSEQ (10–12): Detail line sequence.
    • BDLOC (22–24): Location (level break L5).
    • BDPROD (25–28): Product code (level break L1).
    • BDTANK (29–32): Tank code.
    • BDQTY (35–41): Container quantity.
    • BDPRCE (42–50): Price.
    • BDUM (51–53): Unit of measure (level break L2).
    • BDCSTK (54–73): Customer stock number.
    • BDDESC (75–104): Description.
    • BDCNTR (121–123): Container code (level break L3).
    • BDRQD8 (513–520): Request date (CYMD).
    • BLKPKG (521): Bulk/packaged indicator ('B' or 'P', from BB714A).
    • REFBLD (522–523): Customer sort code (from BB714A).
    • BICONT (Line 0033): BCNAME (4–33): Company name.
    • INLOC (Line 0036): ILNAME (7–26): Location name.
    • INTKRY, INTKRW (Lines 0061–0088): Inventory transaction fields (e.g., IXCO, IXLOC, IXPRCD, IXTANK, IXCNTR, IXDATE, IXQTFT, IXQTSE, etc.).
    • GSPROD, GSCNTR1, GSCTUM, INCHRT: Provide reference data (e.g., product class, container type, unit of measure, tank chart data).
  6. Main Processing Loop (Inferred from Output and Context):

  7. Level Breaks: Uses indicators L1 (BDPROD), L2 (BDUM), L3 (BDCNTR), L4 (BLKPKG), L5 (BDLOC), L6 (REFBLD), L7 (BDCO) to group records for reporting.
  8. Inventory Lookup (L1TANK Subroutine):
    • Chains INTKRY/INTKRW using keys like IXCO, IXLOC, IXPRCD, IXTANK, and IXCNTR to retrieve inventory quantities (IXQTFT, IXQTSE) and tank measurements (IXTOFT, IXTOIN, etc.).
    • Chains INCHRT to get tank capacity (TCSP1) and calculate available inches (AVALIN = IXTOFT - TCSP1).
    • Computes available product (FACT2 = (AVALIN * IXQTTA) / IXTOFT) and updates L1XINV and L2XINV (Lines post-truncation).
    • If INCHRT lookup fails (99), uses IXQTSE directly for inventory (Line 0360).
  9. Quantity Calculations:
    • Accumulates quantities (D1QTY to D5QTY) for five days based on BDRQD8 (request date).
    • Computes weekly totals (L1QTY, L2QTY) and overage (OVQTY, L2VQTY).
    • Calculates differences: L1DIFF = L1XINV - L1QTY - OVQTY, L2DIFF = L2XINV - L2QTY - L2VQTY (Lines 0334, post-0335).
  10. Subroutines:

    • L1TANK: Calculates tank inventory (L1XINV, L2XINV) using INTKRY, INTKRW, and INCHRT.
    • L2TOTL: Computes unit of measure totals and differences (L2HOLD, L2DIFF, Lines post-0335).
  11. Report Output (LIST):

  12. Headers (L4, Lines 0338–0387):
    • Company header: BCNAME, report title, page number (PAGE), system date (SYSDATY), and time (SYSTIM).
    • Column headers: 'CNTR/PROD', 'DESCRIPTION', 'TODAY', day names (DYN,2 to DYN,5), 'WEEK TOTAL', 'LATER', 'TANK INV.', 'BALANCE'.
    • Date headers: DTE,1 to DTE,5 (MMDD format), 'ON ORDER', 'AVAILABLE'.
  13. Detail Lines (L1, Line 0389):
    • Prints container (BDCNTR), product (BDPROD), description (L1CNDS, L1PDSC), unit of measure (BDUM).
    • Daily quantities (D1QTY to D5QTY), weekly total (L1QTY), overage (OVQTY).
    • Tank inventory (L1XINVMB) and balance (L1DIFFMB), suppressed if indicator 50 is off.
  14. Total Lines (L2, Lines 0402–0419):

    • Prints unit of measure totals (L21QTY to L25QTY, L2QTY, L2VQTY), inventory (L2XINVMB), and balance (L2DIFFMB).
    • Includes separator lines for clarity.
  15. Program Termination:

  16. Ends when all BBORDR records are processed or a control break occurs, closing the LIST file.

Business Rules

  1. Data Grouping:
  2. Groups records by company (BDCO, L7), location (BDLOC, L5), customer sort code (REFBLD, L6), bulk/packaged (BLKPKG, L4), container (BDCNTR, L3), unit of measure (BDUM, L2), and product (BDPROD, L1).
  3. Inventory Calculation:
  4. Uses INTKRY/INTKRW to retrieve tank quantities (IXQTFT, IXQTSE) and measurements (IXTOFT, IXTOIN).
  5. Uses INCHRT to calculate available product based on tank capacity (TCSP1) and inches (AVALIN).
  6. Falls back to IXQTSE if INCHRT data is unavailable.
  7. Quantity Aggregation:
  8. Accumulates daily quantities (D1QTY to D5QTY) based on BDRQD8 for a five-day period.
  9. Computes weekly totals (L1QTY, L2QTY) and overage (OVQTY, L2VQTY).
  10. Calculates available balance (L Hawkins,L1DIFF,L2DIFF`) after subtracting ordered quantities and overage from inventory.
  11. Report Format:
  12. Includes company and location details, daily and weekly order quantities, tank inventory, and available balance.
  13. Suppresses inventory and balance fields if indicator 50 is off (likely for non-inventory scenarios).
  14. Data Validation:
  15. Relies on BB715P.rpg36.txt for input validation (company, date, job queue).
  16. Excludes deleted records (BDDEL ≠ 'D', IXDEL ≠ 'D', etc.).

Tables (Files) Used

  • Input Files:
  • BBORDR (mapped to BB715S): Sorted order data (530 bytes).
    • Fields: BDDEL, BDCO, BDORD#, BDSEQ, BDLOC, BDPROD, BDTANK, BDQTY, BDPRCE, BDUM, BDCSTK, BDDESC, BDCNTR, BDRQD8, BLKPKG, REFBLD.
  • BICONT: Company data (256 bytes).
    • Field: BCNAME.
  • INLOC: Location data (512 bytes).
    • Field: ILNAME.
  • INTKRY, INTKRW: Inventory transaction files (128 bytes).
    • Fields: IXDEL, IXCO, IXLOC, IXPRCD, IXTANK, IXCNTR, IXXKEY, IXDATE, IXQTFT, IXQTSE, etc.
  • GSCTUM: Unit of measure data (64 bytes).
  • INCHRT: Tank chart data (512 bytes).
    • Field: TCSP1 (tank capacity).
  • GSCNTR1: Container type data (512 bytes).
  • GSPROD: Product data (512 bytes).

  • Output File:

  • LIST: Printer file (164 bytes) for the report.

External Programs Called

  • MINCHT: Implied by OCL file definitions (MINCHRT, MINSTRP, ICSUMHY), likely for tank chart or inventory processing, though not explicitly called in the provided code.

Notes

  • Change History:
  • 11/04: Added inventory fields for easier reading.
  • 04/18/16 (JK01): Replaced GSTABL with GSCNTR1 for container type.
  • 01/18/23 (JK02): Replaced GSTABL with GSPROD for product data.
  • Integration with OCL: The OCL program (BB715.ocl36.txt) calls BB715 after preprocessing (BB713, BB714, BB714A, #GSORT) to generate the final report from BB715S.
  • Truncation: The missing 27,234 characters likely include the main processing loop, additional subroutines, and logic for chaining files and accumulating quantities. The output specs and context provide sufficient insight into the report structure.
  • Error Handling: Relies on BB715P for input validation; inventory lookups use indicator 99 for missing INCHRT records.

Summary

The BB715 RPG program generates the Daily Requirements Report by processing sorted order data (BBORDR/BB715S), retrieving inventory from INTKRY/INTKRW and INCHRT, and calculating daily/weekly quantities and tank availability. It uses level breaks for grouping and outputs a formatted report via LIST. Files used include BBORDR, BICONT, INLOC, INTKRY, INTKRW, GSCTUM, INCHRT, GSCNTR1, GSPROD, and LIST. The only implied external program is MINCHT.

Files Used: BBORDR, BICONT, INLOC, INTKRY, INTKRW, GSCTUM, INCHRT, GSCNTR1, GSPROD, LIST. External Programs: MINCHT (implied).

If you have the missing code or additional files (e.g., MINCHT), I can provide a more detailed analysis. Let me know!