Skip to content

BB110 RPG36

The BB110.rpg36.txt is a complex RPG II program running on an IBM System/36, designed to print picking tickets, order confirmations, or proforma invoices for the order entry process. It is called by the BB110P.ocl36 program after batch selection and validation in BB110P. The program processes order data, retrieves relevant information from multiple files, calculates totals, and generates formatted output for various report types, including specialized versions for EDI (Viscosity) and packaging plant pick lists. Numerous modifications (JB15–JB62, DC01–DC02, MG29–MG64, JK01–JK05) enhance its functionality to handle specific requirements like freight processing, product descriptions, and weight calculations. Below, I’ll explain the process steps, business rules, tables (files) used, and external programs called.


Process Steps of the BB110 RPG Program

The program processes orders to generate picking tickets (LIST), traffic reports (TRAFFP), packaging plant pick sheets (LIST2), order confirmations (LIST3), or proforma invoices (LIST4). It retrieves order data, validates records, calculates weights and quantities, and updates files as needed. The steps are organized around the program’s logic and output formats.

  1. Initialization:
  2. Initializes variables, clears fields (e.g., HAZMAT, HMSHD1HMSHD4 in HAZMAT subroutine, JB05).
  3. Sets up arrays like KYO (order numbers) and KYF (freight processors) to process up to 10 orders.
  4. Retrieves system date (SYSDATY) and time (SYSTIM) for printing.

  5. Order Retrieval and Validation:

  6. Header Retrieval:
    • Uses KYO (order numbers) and BOCO (company number) to chain to BBORTR (order header file) to retrieve order details (e.g., BOCUST, BOSHIP, BOFPCD, BOVERN).
    • Checks BODEL (delete code) to skip orders marked with 'E' (EDI error, JB22) or 'D' (deleted, JB28).
  7. Detail Retrieval:
    • Chains to BBOTDS1 for detail lines, retrieving fields like BDQTY (quantity), BDGWT (gross weight, JB43), BDPRWT (product weight, JB43), and BDPRXR (cross-reference product code, MG50).
    • Skips detail lines where BDDEL = 'D' (deleted, JB17) to avoid including them in totals.
  8. Marks and Accessorials:

    • Retrieves order remarks (BXOMK1BXOMK4), dispatch marks (BXDSP1BXDSP4), and BOL marks (BXBMK1BXBMK4, BXFRNM) from BBORTO and BBOTA1.
    • Checks BADSPH (dispatch print flag, JB17) to include dispatch marks only when set to 'Y'.
    • Skips printing freight accessorials if BAACCS = 'Y' (JB17).
  9. Freight Processor Handling (JB05, JB27, JB28, DC01):

  10. Subroutine UPDOTS (DC01):
    • Updates BBOTHS1 with freight description (BOFRDS), carrier description (BOTRAN), and freight bill address (BOFRNM, BOFRA1, BOFRA2, etc.).
    • For internal freight processors (FPFPTY ≠ 'EXT', JB27), uses customer address fields (FRNML, FRA1L, etc.).
    • For external freight processors (FPFPTY = 'EXT'), uses freight processor address (FPNAME, FPADR1, etc.) from BBFRPR.
  11. Chains to BBFRPR to retrieve freight processor details (FPNAME, FPADR1, etc.) based on BOFPCD.
  12. Updates BOFPST (freight processor status) and BOVERN (order version number) in BBORTU.

  13. Product and Container Processing:

  14. Subroutine BOLDS2 (JB05):
    • Chains to GSTABL (type CNTRCD) using BDCNTR to retrieve container descriptions (TBDES2).
    • Adjusts description for specific containers (e.g., clears CNTSAV for 'BRAD PEN' if DIVSAV ≠ 50).
  15. Container and Product Codes (JK03, JK05):
    • Uses GSCNTR1 (replacing GSCNTR, JK03) for container codes and GSPROD (replacing PRODCD in GSTABL, JK05) for product codes.
    • Retrieves product descriptions (TBDES2, TBSHDS) and container types (TBCNTY, JB19).
  16. Unit of Measure Conversion (JB23, JB31):

    • Chains to GSCTUM for conversion factors (CUCVFA) to calculate quantities in gallons or pounds (JB31, calls MINLBGL1 for calculations).
    • Supports units like 'KG', 'LI', 'ML', 'OZ' without requiring GSUMCV records (JB40, JB42).
  17. Weight and Quantity Calculations (JB24, JB43, JB47, MG55, MG58):

  18. Calculates total gross weight (L2GWT), net weight (L2NWT, JB47), and gallons (L2NGAL, JB24) for printing.
  19. Uses BDGWT (gross weight in pounds, JB43) and BDPRWT (product weight, JB47) from BBOTDS1.
  20. Accumulates quantities (L2CQT) and miscellaneous charges (L2TOT) for non-deleted lines.
  21. Adds quart conversion for container 420 (MG57).

  22. Address Handling (DC02, JB26, MG44, MG56):

  23. Calls MSHPADR to retrieve compressed ship-to addresses, passing country code (SDCTY, JB26).
  24. Selects correct addresses for EDI 'PF' orders (MG44, MG56) and railcar BOL orders (MG56).
  25. Updates SHPADR with customer, ship-to, and freight bill addresses (SDNAME, SDADR1, etc.).

  26. Printing Reports:

  27. Picking Ticket (LIST, U5):
    • Prints headers with order details (BORDNOZ, BOCUSTZ, BOSHIP, BORQDT, etc.).
    • Includes EDI Viscosity version (JB15, JB18) with specific columns (EDSC1, SDVPPT, SDGRSW) and totals (L2CQT, L2GWT, L2NGAL).
    • Prints dispatch marks (BXDSP1BXDSP4) if BADSPH = 'Y' (JB17).
    • Marks orders on hold (BOORPR = 'H', MG46) with “ON HOLD - DO NOT SHIP”.
  28. Packaging Plant Pick Sheet (LIST2, U5, JK02):
    • Prints headers similar to LIST but tailored for packaging plant (JB19, JB20).
    • Includes columns for size (SIZE), brand (PPBRND, JB20), description (PPDSC1PPDSC3), quantity (BDQTY), gross weight (BDGWT), and gallons (BDQTS, MG58).
    • Prints totals and order status (P$SDSC, JK01).
  29. Order Confirmation (LIST3, U6, MG41):
    • Prints order details, customer and ship-to addresses, payment terms (BOTERM, ARTDSC), and Incoterms (BOINCT, JB38).
    • Includes totals for net quantity (L2CQT), gross weight (L2GWT), net weight (L2NWT), and freight (L2FRT, MG63).
    • Prints notes (NTE array) with standard terms and conditions.
  30. Proforma Invoice (LIST4, U7, MG64):
    • Similar to LIST3 but formatted for proforma invoices, skipping credit limit checks.
    • Includes detailed headers, totals, and Incoterms.
  31. Traffic Report (TRAFFP, U5, MG29):

    • Lists orders with multiple freight tables (BFFTCN, BBORF), including order number, customer, carrier, and requested date.
  32. File Updates:

  33. Updates BBOTHS1 with freight and carrier details (UPDOTS, DC01).
  34. Updates BBORTU with pick list printed flag (BOPPIK = 'Y'), freight processor status (BOFPST), and version number (BOVERN).
  35. Updates BBOTDS1 with product descriptions (PPDSC1, PPDSC2, PPDSC3, JB51), size (SIZE), and hazmat details (HAZMAT, HZDESC).
  36. Adds or updates BBSRNH (shipping reference number) and SHPADR (shipment addresses) with order and customer details (JB14).
  37. Releases record locks in SHPADR (RELSHA, JB25) and BBOTHS1 (RELOTS, DC01).

  38. Program Termination:

  39. Sets LR indicator to exit after processing all orders and printing reports.

Business Rules

  1. Order Validation:
  2. Skips orders with BODEL = 'E' (EDI error, JB22) or BODEL = 'D' unless sent to internal freight processor (JB28).
  3. Skips detail lines with BDDEL = 'D' for totals and printing (JB17).

  4. Freight Processor Logic (JB27, JB28, DC01):

  5. Internal Freight Processor (FPFPTY ≠ 'EXT'):
    • Uses customer address (FRNML, FRA1L, etc.) for freight billing.
  6. External Freight Processor (FPFPTY = 'EXT'):
    • Uses freight processor address (FPNAME, FPADR1, etc.) from BBFRPR.
  7. Freight bill address is passed to BB113 for further processing (JB27).
  8. Deleted orders are sent to internal freight processors (JB28).

  9. EDI and Packaging Plant Handling:

  10. EDI Viscosity Pick List (JB15, JB18):
    • Formats pick list with specific columns (description, code, quantity, gross weight, part number).
    • Adjusts column positions to avoid off-page printing (JB18, MG32).
  11. Packaging Plant Pick List (JB19, JB20, JB52):

    • Prints size, brand, description, quantity, gross weight, and gallons.
    • Right-justifies brand and renames “CODE” to “PART #” (JB20).
    • Removes old refinery pick list formats, keeping EDI format (JB52).
  12. Weight and Quantity Calculations:

  13. Gross weight (L2GWT) and net weight (L2NWT) are calculated from BDGWT and BDPRWT (JB43, JB47).
  14. Total gallons (L2NGAL) are calculated for pick lists (JB24).
  15. Quart conversions are applied for container 420 (MG57).
  16. Skips gross weight recalculation as it’s done in BB101 (JB43).

  17. Printing Rules:

  18. Prints “ON HOLD - DO NOT SHIP” for orders with BOORPR = 'H' (MG46).
  19. Prints “PRELIMINARY” or “FINAL PICK SHEET” based on order status (BOORPR = 'R' or 'C' for final, JB39).
  20. Includes Incoterms (BOINCT, JB38) and loading location (GMMLDS, GMLOD1GMLOD3, JB37) on pick sheets.
  21. Prints order status description (P$SDSC, JK01) on totals line.
  22. Skips freight total amount (L2FRT) printing (JB37).
  23. Includes standard notes (NTE) on order confirmations and proforma invoices (MG41, MG64).

  24. File Updates:

  25. Updates BOPPIK = 'Y' to mark pick list printed.
  26. Ensures product descriptions (PPDSC1PPDSC3) are written to BBOTDS1 instead of LIST (JB51).
  27. Releases record locks to prevent conflicts between jobs (JB25, DC01).

  28. Error Handling:

  29. Validates records in BBORTR, BBOTDS1, BBFRPR, GSTABL, etc., using CHAIN operations.
  30. Handles missing records gracefully (e.g., tries blank container type if ARCUPR lookup fails, JB45).

Tables (Files) Used

  1. BBORTR (Input, 553 bytes, indexed):
  2. Order header file, retrieves order details (e.g., BOCUST, BOSHIP, BOFPCD, BOORPR).
  3. BBOTHS1 (Update, 512 bytes, indexed):
  4. Order header supplemental file, updated with freight and carrier details (BOFRDS, BOTRAN, BOFRNM).
  5. BBOTDS1 (Update, 512 bytes, indexed):
  6. Order detail file, retrieves and updates quantities (BDQTY), weights (BDGWT, BDPRWT), and descriptions (PPDSC1PPDSC3).
  7. BBORTU (Update, 512 bytes, indexed):
  8. Order header update file, updates pick list flag (BOPPIK), freight processor status (BOFPST), and version number (BOVERN).
  9. BBOTA1 (Input, 512 bytes, indexed):
  10. Accessorials/marks file, retrieves remarks and dispatch marks (BADESC, BXDSP1BXDSP4).
  11. BBORCL (Input, 256 bytes, indexed):
  12. Order close file, checks over-limit status (BLOVCL) and authorization (BLAUIN).
  13. BBORTO (Input, 512 bytes, indexed):
  14. Order remarks file, retrieves order, invoice, and BOL remarks (BXOMK1BXOMK4, BXBMK1BXBMK4, BXFRNM).
  15. ARCUST (Input, 384 bytes, indexed):
  16. Customer master file, retrieves customer name (ARNAME) and address (ARADR1ARADR4).
  17. ARCUPR (Input, 80 bytes, indexed):
  18. Customer product file, retrieves custom product descriptions (CPCPDS) and container types (CPCNTY, JB45).
  19. SHIPTO (Input, 2048 bytes, indexed):
    • Ship-to address file, retrieves alternate pricing flags (CSALTO).
  20. GSCONT (Input, 512 bytes, indexed):
    • Contract file, retrieves warehouse information (GXWHSE).
  21. GSTABL (Input, 256 bytes, indexed):
    • Table file, retrieves container (CNTRCD) and product (PRODCD) descriptions, gravity (TBGRAV), and other attributes.
  22. GSPRCT (Input, 256 bytes, indexed, MG48):
    • Product characteristics file, retrieves additional product details.
  23. GSCTUM (Input, 64 bytes, indexed):
    • Unit of measure conversion file, retrieves conversion factors (CUCVFA) and issue units (CUIUM, VV04).
  24. BICONT (Input, 256 bytes, indexed):
    • Company control file, retrieves company name (BCNAME).
  25. GSHAZM (Input, 384 bytes, indexed, JB05):
    • Hazardous materials file, retrieves hazmat descriptions (HMSHD1HMSHD4).
  26. BBFRPR (Input, 256 bytes, indexed, JB05):
    • Freight processor file, retrieves processor details (FPNAME, FPADR1, FPCTRY, FPFPTY).
  27. BBSRNH (Update, 128 bytes, indexed, JB14):
    • Shipping reference number file, updated with order and freight processor details.
  28. CUADR (Input, 448 bytes, indexed, JB14):
    • Customer address file, retrieves EDI address details (CDNAME, CDADR1, CDCTY).
  29. SHPADR (Update, 448 bytes, indexed, JB14):
    • Shipment address file, updated with order-specific addresses (SDNAME, SDADR1, SDZIP).
  30. EDICUS (Input, 384 bytes, indexed, JB14):
    • EDI customer file, retrieves shipper details for EDI '856' orders (EISHNM, EISHA1).
  31. BBASND (Input, 512 bytes, indexed, JB15):
    • Advance ship notice file, retrieves vendor part (SDVPPT), buyer part (SDBYPT), and batch number (SDBTCH).
  32. BBORF (Input, 640 bytes, indexed, MG29):
    • Freight table file, retrieves freight table count (BFFTCN) for traffic report.
  33. GSMLCD (Input, 296 bytes, indexed, JB37):
    • Major location code file, retrieves loading location descriptions (GMMLDS, GMLOD1GMLOD3).
  34. ARCUFMX (Input, 266 bytes, indexed):
    • Customer format file, retrieves email addresses (EIFM array) for confirmations.
  35. GSCNTR1 (Input, 512 bytes, indexed, JK03):
    • Container file, replaces GSCNTR for container code lookup.
  36. BBCAID (Input, 200 bytes, indexed, JK04):
    • Carrier ID file, replaces BBCAID type in GSTABL for carrier lookup.
  37. GSPROD (Input, 512 bytes, indexed, JK05):
    • Product file, replaces PRODCD type in GSTABL for product lookup.

Output Files: 29. LIST (Output, 132 bytes, printer, U5): - Prints standard picking tickets, including EDI Viscosity format. 30. TRAFFP (Output, 132 bytes, printer, U5): - Prints traffic report for multiple freight tables. 31. LIST2 (Output, 132 bytes, printer, U5, JK02): - Prints packaging plant pick sheets. 32. LIST3 (Output, 132 bytes, printer, U6, MG41): - Prints order confirmations. 33. LIST4 (Output, 132 bytes, printer, U7, MG64): - Prints proforma invoices.


External Programs Called

  1. MSHPADR (DC02, JB26):
  2. Retrieves compressed ship-to addresses, passing company, order, customer, ship-to, and country code (SDCTY).
  3. MINLBGL1 (JB31):
  4. Calculates gallons or pounds for unit of measure conversions, replacing MINLBGL.

Summary

The BB110 RPG program is a critical component of the order entry system, generating picking tickets, order confirmations, proforma invoices, and traffic reports. It: - Retrieves and validates order data from multiple files (BBORTR, BBOTDS1, etc.). - Handles specialized formats for EDI Viscosity (JB15, JB18) and packaging plant pick lists (JB19, JB20). - Processes freight details, distinguishing between internal and external processors (JB27, DC01). - Calculates weights, quantities, and gallons, updating files with descriptions, statuses, and addresses. - Prints detailed reports with headers, detail lines, totals, and notes, tailored to specific requirements.

Tables Used: BBORTR, BBOTHS1, BBOTDS1, BBORTU, BBOTA1, BBORCL, BBORTO, ARCUST, ARCUPR, SHIPTO, GSCONT, GSTABL, GSPRCT, GSCTUM, BICONT, GSHAZM, BBFRPR, BBSRNH, CUADR, SHPADR, EDICUS, BBASND, BBORF, GSMLCD, ARCUFMX, GSCNTR1, BBCAID, GSPROD, LIST, TRAFFP, LIST2, LIST3, LIST4. External Programs Called: MSHPADR, MINLBGL1.