BB110 RPG36
Process Steps of the RPG Program BB110¶
This RPG III program (BB110) is the core printing engine for generating picking tickets, order confirmations, or proforma invoices based on pre-sorted order data (from prior steps like sorting in BB111 and preprocessing in BB1103). It supports multiple formats (e.g., standard pick lists, viscosity/EDI versions, packaging plant versions, confirmations) with custom layouts, calculations, and conditional printing. The program processes records in a cycle: reading input sequentially, chaining to lookup files for descriptions/addressing/weights, accumulating totals (qty, weight, price, freight, misc charges), and outputting to printer files with headers, details, totals, and notes. It handles modes via user options (U5 for picks, U6 for confirmations) and revisions add features like EDI handling, freight calculations, and special groupings. Based on the visible code and revision comments (full code truncated), below is a step-by-step flow:
- Program Initialization:
- Header (H) specs define options (P064, B for batch/print). Sets defaults for totals (e.g., net/gross weight, qty, prices to 0), indicators for modes (e.g., U5/U6), and work fields (e.g., for addresses, descriptions).
- Calculates or sets initial values like current date, company defaults. Handles Y2K via prior GSY2K call in OCL.
-
Opens files (input from sorted BBORTR/BB1113S, lookups like ARCUST, printer files LIST/LIST2/LIST3).
-
Read Input Records (Main Cycle):
- Reads primary input (e.g., BBORTR) sequentially (sorted by company/order/seq, headers first).
- Identifies record types: Headers (e.g., via markers in pos 121-123), details, marks/accessorials, others.
-
For each order (level break on company/order#):
- Processes header: Chains to files like BBORDH/BBORCL for status (BOORPR), customer (BOCUST), ship-to (BOSHIP), freight (BOCAR), etc. Validates status (e.g., skip if deleted 'D' or error 'E'; print "ON HOLD - DO NOT SHIP" for 'H').
- Accumulates order-level data (e.g., incoterms from BOINCT, route from BOROUT).
-
Detail Processing and Calculations:
- For detail lines: Chains to products (GSPROD/GSPRCT for desc), containers (GSCNTR1 for size/alpha key), locations (INLOC/GSMLCD for loading loc), customers (ARCUST/ARCUPR for pricing/cross-ref, try with CNTR type first then blank/'P' for non-fluid).
- Calculates:
- Quantities/weights: Uses GSUMCV/GSCTWT/GSCTUM for conversions (e.g., skip for 'KG'/'LI'/'ML'/'OZ'). Calls MINLBGL1 for gallons/lbs (revised formula). Adds product weight to net for confirmations.
- Prices/extensions: From ARCUPR, accumulates to TOTPRC.
- Freight/misc: Chains GSTABL for carrier desc, calculates/accumulates L2FRT/L2TOT (misc charges). Handles internal/external freight (don't use processor addr for internal; send deleted orders to internal).
- Totals: Net/gross wt (GWT in lbs), qty (BDQTY), gallons (from JB24). Excludes deleted details from totals.
-
Special handling: For EDI856/viscosity (customer-owned 'Y'), rearranges columns, sorts/groups (see BB1103). For PKG plant: Custom desc (PPDSC1-3), right-justify brand. For grease: Custom desc transition.
-
Output Printing:
- Printer files (LIST for picks, LIST2 for PKG picks, LIST3 for confirmations) with overrides from OCL (e.g., CPI, forms, queues).
- Headers: Prints company addr (from constants like "AMERICAN REFINING GROUP"), customer/ship-to (compressed via MSHPADR call, incl. country), order info (date, PO, status desc from JK01).
- Details: Prints lines with loc/prod/cntr/price/ext (rearranged for versions). Groups by sort keys (dotted/solid lines at breaks/headings from JB16/JB17).
- Marks/Accessorials: Prints if dispatch marks 'Y'; skips if freight accessorial 'Y'.
- Totals: Prints net/gross wt (lbs), qty, misc, price total, freight (estimate, fluctuates with diesel index). For 3rd party freight: "SEND FREIGHT BILL TO" addr.
- Notes: Prints standard terms (from ** NTE constants, e.g., terms of sale, driver PPE, export rules, MSDS link).
- Special formats: Viscosity (move fields off edge, match Lotus), PKG plant (size/desc/qty/gwt/um), confirmations (select addr for EDI 'PF' BOL, expanded cross-ref/desc).
-
Writes updates: To BBOCFR (confirm work), BBOTHS (freight/carrier desc, bill-to addr), order files for PKG desc (JB51).
-
Post-Processing and Termination:
- Calls BB113 for freight calc (passes bill addr, handles multiple tables with Spoolflex print for traffic).
- Closes files, ends via LR. If errors (e.g., no GSUMCV), handles gracefully (e.g., zero fields).
The program runs in batch (from OCL), processes one batch of orders, and supports revisions for specific clients (e.g., viscosity EDI, PKG plant).
Business Rules¶
- Print Eligibility: Skip if header deleted ('D') or error ('E' from EDI). For hold ('H'): Print but mark "ON HOLD - DO NOT SHIP". Process 'R' (revised/complete) same as 'C' (complete).
- Modes: U5 for picks (standard/viscosity/PKG), U6 for confirmations (manual selection, net wt incl. product wt).
- Calculations: Gross/net wt in lbs (add product wt for confirmations; from BB101 pre-calc). Gallons/lbs via MINLBGL1 (no GSUMCV req for certain UOM). Prices at shipment time. Freight estimates fluctuate with diesel index; use correct bill addr (internal: not processor; external: processor). Accumulate misc charges; exclude deleted details.
- Formatting: Custom for types (e.g., viscosity: rearrange/sort per JB18; PKG: right-justify brand, part# heading). Print incoterms, route code, order status desc on totals. Dotted/solid lines for groups/headings. Expanded cross-ref/desc for confirmations.
- Freight Handling: Internal/external distinction; send deleted to internal. Print multiple tables notice via Spoolflex. Select EDI 'PF' addr for BOL.
- Addresses: Compress ship-to via MSHPADR (incl. country). 3rd party: Print bill-to.
- Notes/Terms: Always print standard notes (terms, PPE, bulk requirements, export compliance, MSDS).
- Data Integrity: Chain fallbacks (e.g., ARCUPR with CNTR then blank/'P'). No off-page printing (MG32). Handle grease desc transition, loading loc from GSMLCD.
Tables Used¶
Based on file specs (inferred from comments and OCL load), the program uses:
BBORTR
: Input primary (sorted records from BB1113S).BBOCFR
: Input/output (confirmation work file).BBORCL
: Input (order control).ARCUST
: Input (customers).ARCUPR
: Input keyed (pricing, cross-ref; key incl. CNTR type).SHIPTO
: Input (ship-to).GSCONT
: Input (contacts?).GSTABL
: Input keyed (tables, e.g., CNTRCD, carrier desc; avoid freight GL for details).GSUMCV
: Input (unit conversions; optional for some UOM).GSCTWT
: Input (carton weights).GSCTUM
: Input (carton UOM).BICONT
: Input (bill-to contacts?).GSHAZM
: Input (hazmat).BBFRPR
: Input (freight pricing?).BBSRNH
: Input (serial numbers?).CUADR
: Input (customer addresses).SHPADR
: Input (ship addresses).EDICUS
: Input (EDI customers).BBASND
: Input (ASN?).BBSHPH
: Input (ship headers?).BBSHPD
: Input (ship details?).BBORHS1
: Input (order headers).BBORDS1
: Input (order details).BBORA
: Input (order attachments?).BBFPORH
: Input (freight PO headers).BBFPORD
: Input (freight PO details).BBFPORA
: Input (freight PO attachments).BBORDB
: Input (order rebates?).BBORF
: Input (order freight?).BBFPORF
: Input (freight PO freight).ARCUFMX
: Input (customer format matrix?).GSCNTR
: Input (countries; replaced by GSCNTR1).GSCNTR1
: Input keyed (containers, alpha key for desc).GSPROD
: Input (products).GSPRCT
: Input (product categories?).GSMLCD
: Input (multi-location codes, loading loc).BBCAID
: Input (carrier IDs).BBOTHS
: Update (freight/carrier desc, bill-to addr).- Printer files:
LIST
(picks),LIST2
(PKG picks),LIST3
(confirmations).
Most are input keyed for chains; some updates (e.g., BBOTHS).
External Programs Called¶
From revision comments:
MSHPADR
: Called for compressed ship-to addr (parms incl. country).MINLBGL1
: Called for gallons/lbs calc (revised formula).BB113
: Called for freight calc (passes bill addr; handles multiple tables).
No others visible in truncated code.