Skip to content

BB9531 RPG36

The provided document, BB9531.rpg36.txt, is an RPG (Report Program Generator) program for the IBM System/36 environment (or AS/400 in compatibility mode), named BB9531. It is invoked by the OCL script BB953B.ocl36.txt as part of the rack pricing process within the PRICES.ocl36.txt workflow, which is itself called by PRICEGEN.clp. The program preprocesses pricing data from the BBPRCE file, enriches it with product and table data, and writes to a temporary file BB9531 for further processing in the rack price reporting sequence. Below, I will explain the process steps, business rules, tables used, and external programs called, noting that the document is truncated but sufficient to infer key functionality .

Process Steps of the RPG Program

  1. File Definitions:
  2. Input Files:
    • BBPRCE (Input Primary, IP, 128 bytes, indexed with 27-byte key, disk): Pricing history file, mapped to ?9?BBPRCE (e.g., ABBPRCE), containing rack price records.
    • GSTABL (Input, IF, 256 bytes, indexed with 12-byte key, disk): Table file for product class and division data.
    • GSPROD (Input, IF, 512 bytes, indexed with 6-byte key, disk): Product file for product details (added per JK01 revision).
  3. Output File:

    • BB9531 (Output, O, 169 bytes, disk): Temporary file, mapped to ?9?BB9531 (e.g., ABB9531), for preprocessed pricing data.
  4. Extension Specifications:

  5. Arrays for storing pricing and quantity data:

    • RKPR (5 elements, 9 bytes, 4 decimals): Rack prices (RKPR,1 to RKPR,5).
    • RKQT (5 elements, 7 bytes, 0 decimals): Quantity levels.
    • HLPR (5 elements, 9 bytes, 4 decimals): Holding prices (current prices).
    • HLQT (5 elements, 7 bytes, 0 decimals): Holding quantities.
    • PRPR (5 elements, 9 bytes, 4 decimals): Previous prices.
  6. Input Specifications:

  7. BBPRCE (record type NS):
    • RKDEL (1): Delete code ('D' for deleted records).
    • RKCONOL3 (2–3): Company number.
    • RKLOC (4–6): Location.
    • RKPRODL1 (7–10): Product code.
    • RKCNTRL1 (11–13): Container code.
    • RKUNMSL1 (14–16): Unit of measure.
    • RKDATE (17–24): Date (CYMD format, CCYYMMDD).
    • RKTIME (25–28): Time (HHMM).
    • RKPR,1 to RKPR,5 (30–58): Rack prices (packed, 4 decimals).
    • RKMINQ (59–65): Minimum quantity.
    • RKQT (66–100): Quantity level array.
    • RKRKRQ (101): No rack price required flag (added per JB03).
    • RKINAC (102): Inactive flag (b, I, B, added per JB03).
  8. GSTABL (record type NS 01):
    • TBDEL (1): Delete code.
    • TBPRCL (127–129): Product class code.
    • TBCSRT (178–179): Inventory company sort (division code).
    • TBPRGP (121–122): Product group code.
  9. GSPROD (record type NS, per JK01):

    • TPDEL (1): Delete code.
    • TPDESC (14–43): Product description.
    • TPPRGP (89–90): Product group code.
    • TPPRCL (127–129): Product class code.
    • TPABDS (145–154): Short description.
  10. Calculation Specifications (partially shown due to truncation):

  11. Main Loop:
    • Processes each BBPRCE record (01 DO, implied).
  12. Filtering:
    • Skips records with RKDEL = 'D' (deleted).
    • Applies selection criteria from the User Data Structure (UDS), set by BB953B.ocl36.txt:
    • KYDIV ('ALL' or 'CO'): Filters by division.
    • KYLOSL ('SEL'): Filters by locations (KYLOC1KYLOC5).
    • KYPCSL ('SEL'): Filters by product classes (KYPC01KYPC10).
    • KYCTSL ('SEL'): Filters by containers (KYCT01KYCT05).
    • KYPDSL ('SEL'): Filters by products (KYPD01KYPD10).
    • KYDTSL ('SEL'): Filters by date range (KYFRDT to KYTODT).
  13. Lookups:
    • Chains GSPROD using RKPROD to get product group (TPPRGP), class (TPPRCL), and short description (TPABDS, per JK01).
    • Chains GSTABL for division (TBCSRT) and product group (TBPRGP).
  14. Date Conversion ($DATE subroutine):
    • Converts RKDATE (CYMD) to Julian format (G$JD) and back to Gregorian ($MDY, MMDDYY):
    • G$JD / 365.25 calculates year (G$YYWK).
    • Adjusts for leap years and calculates day (G$YD), month (G$M), and day of month (G$D).
    • Combines into $MDY (MMDDYY) with century ($CN).
  15. Price and Quantity Processing:
    • Moves RKPR,1RKPR,5 to HLPR (current prices).
    • Moves RKQT to HLQT (quantity levels).
    • Likely retrieves previous prices (PRPR) from another file or logic (not shown).
  16. Output:

    • Writes to BB9531 via ADD951 exception output for valid records.
  17. Output Specifications:

  18. BB9531 (E, ADD951):
    • RKCONO (1–2): Company number.
    • RKLOC (3–5): Location.
    • TPPRGP (6–7): Product group (from GSPROD, per JK01).
    • RKPROD (8–11): Product code.
    • RKCNTR (12–14): Container code.
    • RKUNMS (15–17): Unit of measure.
    • HLQT (18–52): Quantity levels (5 elements).
    • HLPR (53–82): Current prices (5 elements, packed).
    • PRPR (83–112): Previous prices (5 elements, packed).
    • DES1CP (113–132): Product description (likely from GSPROD).
    • ABDSCP (133–142): Short description (from GSPROD).
    • RKDATE (143–150): Date (CYMD).
    • RKTIME (151–154): Time (HHMM).
    • RKMINQ (155–161): Minimum quantity.
    • DIV (162–164): Division code (from GSTABL).
    • PRCL (165–167): Product class (from GSPROD or GSTABL).
    • HLRKRQ (168): No rack price required flag (from RKRKRQ, per JB03).
    • HLINAC (169): Inactive flag (from RKINAC, per JB03).

Business Rules

  1. Purpose: Preprocesses pricing data from BBPRCE to create a temporary file (BB9531) with enriched rack price data, including product group, descriptions, division, and flags for rack price requirements and inactivity, for use in subsequent rack price reporting steps.
  2. Filtering:
  3. Excludes deleted records (RKDEL = 'D').
  4. Applies filters based on UDS fields (set by BB953B.ocl36.txt):
    • Division (KYDIV = 'ALL' or specific company).
    • Locations (KYLOSL = 'SEL', matching KYLOC1KYLOC5).
    • Product classes (KYPCSL = 'SEL', matching KYPC01KYPC10).
    • Containers (KYCTSL = 'SEL', matching KYCT01KYCT05).
    • Products (KYPDSL = 'SEL', matching KYPD01KYPD10).
    • Date range (KYDTSL = 'SEL', KYFRDT to KYTODT).
  5. Data Enrichment:
  6. Retrieves product group (TPPRGP), class (TPPRCL), and short description (TPABDS) from GSPROD (per JK01).
  7. Retrieves division (TBCSRT) from GSTABL.
  8. Copies prices (RKPR to HLPR), quantities (RKQT to HLQT), and previous prices (PRPR).
  9. Includes flags RKRKRQ and RKINAC (per JB03).
  10. Date Conversion:
  11. Converts RKDATE (CYMD) to Julian (G$JD) and back to Gregorian ($MDY, MMDDYY) for reporting or compatibility.
  12. Context: Part of the BB953B.ocl36.txt workflow, producing ?9?BB9531 for BB9534, which is sorted and used by BB953 to generate the final rack price report (?9?RKPRCE).

Tables (Files) Used

  1. BBPRCE (?9?BBPRCE):
  2. Access: Input Primary (IP), shared read with record locking.
  3. Purpose: Source of rack pricing data (company, location, product, container, prices, quantities).
  4. GSTABL (?9?GSTABL):
  5. Access: Input (IF), shared read with record locking.
  6. Purpose: Provides division (TBCSRT) and product group (TBPRGP) data.
  7. GSPROD (?9?GSPROD):
  8. Access: Input (IF), shared read with record locking.
  9. Purpose: Provides product group (TPPRGP), class (TPPRCL), and description (TPABDS, TPDESC).
  10. BB9531 (?9?BB9531):
  11. Access: Output (O).
  12. Purpose: Temporary file for preprocessed pricing data (169 bytes).

External Programs Called

  • None: The BB9531 RPG program does not call external programs or subroutines. It performs internal processing using the $DATE subroutine for date conversion.

Additional Notes

  • Context: Invoked by BB953B.ocl36.txt after BB953B, producing ?9?BB9531 for BB9534, which is sorted and used by BB953 for the rack price report.
  • Revisions:
  • 02/16/00 (Jan Beccari): Rewritten to simplify and fix issues.
  • JB03 (09/2012): Added RKRKRQ and RKINAC fields to output.
  • JB04 (10/08/12): Fixed division selection (KYDIV).
  • JK01 (01/26/23): Replaced GSTABL with GSPROD for product data.
  • System/36 Environment: Uses RPG II/III syntax, likely on AS/400.
  • Truncation: The document is truncated, but output specifications and context provide sufficient detail. Missing calculations likely involve chaining GSPROD and GSTABL and applying filters.
  • Error Handling: Relies on indicators and System/36 environment for error handling.

If you have the RPG source code for BB9534, BB953, or the SA505* programs, or need further analysis, please provide those details! Let me know if you have additional questions or files to share.