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.
- Initialization:
- Initializes variables, clears fields (e.g.,
HAZMAT
,HMSHD1
–HMSHD4
inHAZMAT
subroutine, JB05). - Sets up arrays like
KYO
(order numbers) andKYF
(freight processors) to process up to 10 orders. -
Retrieves system date (
SYSDATY
) and time (SYSTIM
) for printing. -
Order Retrieval and Validation:
- Header Retrieval:
- Uses
KYO
(order numbers) andBOCO
(company number) to chain toBBORTR
(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).
- Uses
- Detail Retrieval:
- Chains to
BBOTDS1
for detail lines, retrieving fields likeBDQTY
(quantity),BDGWT
(gross weight, JB43),BDPRWT
(product weight, JB43), andBDPRXR
(cross-reference product code, MG50). - Skips detail lines where
BDDEL = 'D'
(deleted, JB17) to avoid including them in totals.
- Chains to
-
Marks and Accessorials:
- Retrieves order remarks (
BXOMK1
–BXOMK4
), dispatch marks (BXDSP1
–BXDSP4
), and BOL marks (BXBMK1
–BXBMK4
,BXFRNM
) fromBBORTO
andBBOTA1
. - Checks
BADSPH
(dispatch print flag, JB17) to include dispatch marks only when set to'Y'
. - Skips printing freight accessorials if
BAACCS = 'Y'
(JB17).
- Retrieves order remarks (
-
Freight Processor Handling (JB05, JB27, JB28, DC01):
- 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.) fromBBFRPR
.
- Updates
- Chains to
BBFRPR
to retrieve freight processor details (FPNAME
,FPADR1
, etc.) based onBOFPCD
. -
Updates
BOFPST
(freight processor status) andBOVERN
(order version number) inBBORTU
. -
Product and Container Processing:
- Subroutine BOLDS2 (JB05):
- Chains to
GSTABL
(typeCNTRCD
) usingBDCNTR
to retrieve container descriptions (TBDES2
). - Adjusts description for specific containers (e.g., clears
CNTSAV
for'BRAD PEN'
ifDIVSAV ≠ 50
).
- Chains to
- Container and Product Codes (JK03, JK05):
- Uses
GSCNTR1
(replacingGSCNTR
, JK03) for container codes andGSPROD
(replacingPRODCD
inGSTABL
, JK05) for product codes. - Retrieves product descriptions (
TBDES2
,TBSHDS
) and container types (TBCNTY
, JB19).
- Uses
-
Unit of Measure Conversion (JB23, JB31):
- Chains to
GSCTUM
for conversion factors (CUCVFA
) to calculate quantities in gallons or pounds (JB31, callsMINLBGL1
for calculations). - Supports units like
'KG'
,'LI'
,'ML'
,'OZ'
without requiringGSUMCV
records (JB40, JB42).
- Chains to
-
Weight and Quantity Calculations (JB24, JB43, JB47, MG55, MG58):
- Calculates total gross weight (
L2GWT
), net weight (L2NWT
, JB47), and gallons (L2NGAL
, JB24) for printing. - Uses
BDGWT
(gross weight in pounds, JB43) andBDPRWT
(product weight, JB47) fromBBOTDS1
. - Accumulates quantities (
L2CQT
) and miscellaneous charges (L2TOT
) for non-deleted lines. -
Adds quart conversion for container
420
(MG57). -
Address Handling (DC02, JB26, MG44, MG56):
- Calls
MSHPADR
to retrieve compressed ship-to addresses, passing country code (SDCTY
, JB26). - Selects correct addresses for EDI
'PF'
orders (MG44, MG56) and railcar BOL orders (MG56). -
Updates
SHPADR
with customer, ship-to, and freight bill addresses (SDNAME
,SDADR1
, etc.). -
Printing Reports:
- 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 (
BXDSP1
–BXDSP4
) ifBADSPH = 'Y'
(JB17). - Marks orders on hold (
BOORPR = 'H'
, MG46) with “ON HOLD - DO NOT SHIP”.
- Prints headers with order details (
- 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 (PPDSC1
–PPDSC3
), quantity (BDQTY
), gross weight (BDGWT
), and gallons (BDQTS
, MG58). - Prints totals and order status (
P$SDSC
, JK01).
- Prints headers similar to
- 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.
- Prints order details, customer and ship-to addresses, payment terms (
- Proforma Invoice (LIST4, U7, MG64):
- Similar to
LIST3
but formatted for proforma invoices, skipping credit limit checks. - Includes detailed headers, totals, and Incoterms.
- Similar to
-
Traffic Report (TRAFFP, U5, MG29):
- Lists orders with multiple freight tables (
BFFTCN
,BBORF
), including order number, customer, carrier, and requested date.
- Lists orders with multiple freight tables (
-
File Updates:
- Updates
BBOTHS1
with freight and carrier details (UPDOTS
, DC01). - Updates
BBORTU
with pick list printed flag (BOPPIK = 'Y'
), freight processor status (BOFPST
), and version number (BOVERN
). - Updates
BBOTDS1
with product descriptions (PPDSC1
,PPDSC2
,PPDSC3
, JB51), size (SIZE
), and hazmat details (HAZMAT
,HZDESC
). - Adds or updates
BBSRNH
(shipping reference number) andSHPADR
(shipment addresses) with order and customer details (JB14). -
Releases record locks in
SHPADR
(RELSHA
, JB25) andBBOTHS1
(RELOTS
, DC01). -
Program Termination:
- Sets
LR
indicator to exit after processing all orders and printing reports.
Business Rules¶
- Order Validation:
- Skips orders with
BODEL = 'E'
(EDI error, JB22) orBODEL = 'D'
unless sent to internal freight processor (JB28). -
Skips detail lines with
BDDEL = 'D'
for totals and printing (JB17). -
Freight Processor Logic (JB27, JB28, DC01):
- Internal Freight Processor (
FPFPTY ≠ 'EXT'
):- Uses customer address (
FRNML
,FRA1L
, etc.) for freight billing.
- Uses customer address (
- External Freight Processor (
FPFPTY = 'EXT'
):- Uses freight processor address (
FPNAME
,FPADR1
, etc.) fromBBFRPR
.
- Uses freight processor address (
- Freight bill address is passed to
BB113
for further processing (JB27). -
Deleted orders are sent to internal freight processors (JB28).
-
EDI and Packaging Plant Handling:
- 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).
-
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).
-
Weight and Quantity Calculations:
- Gross weight (
L2GWT
) and net weight (L2NWT
) are calculated fromBDGWT
andBDPRWT
(JB43, JB47). - Total gallons (
L2NGAL
) are calculated for pick lists (JB24). - Quart conversions are applied for container
420
(MG57). -
Skips gross weight recalculation as it’s done in
BB101
(JB43). -
Printing Rules:
- Prints “ON HOLD - DO NOT SHIP” for orders with
BOORPR = 'H'
(MG46). - Prints “PRELIMINARY” or “FINAL PICK SHEET” based on order status (
BOORPR = 'R'
or'C'
for final, JB39). - Includes Incoterms (
BOINCT
, JB38) and loading location (GMMLDS
,GMLOD1
–GMLOD3
, JB37) on pick sheets. - Prints order status description (
P$SDSC
, JK01) on totals line. - Skips freight total amount (
L2FRT
) printing (JB37). -
Includes standard notes (
NTE
) on order confirmations and proforma invoices (MG41, MG64). -
File Updates:
- Updates
BOPPIK = 'Y'
to mark pick list printed. - Ensures product descriptions (
PPDSC1
–PPDSC3
) are written toBBOTDS1
instead ofLIST
(JB51). -
Releases record locks to prevent conflicts between jobs (JB25, DC01).
-
Error Handling:
- Validates records in
BBORTR
,BBOTDS1
,BBFRPR
,GSTABL
, etc., usingCHAIN
operations. - Handles missing records gracefully (e.g., tries blank container type if
ARCUPR
lookup fails, JB45).
Tables (Files) Used¶
- BBORTR (Input, 553 bytes, indexed):
- Order header file, retrieves order details (e.g.,
BOCUST
,BOSHIP
,BOFPCD
,BOORPR
). - BBOTHS1 (Update, 512 bytes, indexed):
- Order header supplemental file, updated with freight and carrier details (
BOFRDS
,BOTRAN
,BOFRNM
). - BBOTDS1 (Update, 512 bytes, indexed):
- Order detail file, retrieves and updates quantities (
BDQTY
), weights (BDGWT
,BDPRWT
), and descriptions (PPDSC1
–PPDSC3
). - BBORTU (Update, 512 bytes, indexed):
- Order header update file, updates pick list flag (
BOPPIK
), freight processor status (BOFPST
), and version number (BOVERN
). - BBOTA1 (Input, 512 bytes, indexed):
- Accessorials/marks file, retrieves remarks and dispatch marks (
BADESC
,BXDSP1
–BXDSP4
). - BBORCL (Input, 256 bytes, indexed):
- Order close file, checks over-limit status (
BLOVCL
) and authorization (BLAUIN
). - BBORTO (Input, 512 bytes, indexed):
- Order remarks file, retrieves order, invoice, and BOL remarks (
BXOMK1
–BXOMK4
,BXBMK1
–BXBMK4
,BXFRNM
). - ARCUST (Input, 384 bytes, indexed):
- Customer master file, retrieves customer name (
ARNAME
) and address (ARADR1
–ARADR4
). - ARCUPR (Input, 80 bytes, indexed):
- Customer product file, retrieves custom product descriptions (
CPCPDS
) and container types (CPCNTY
, JB45). - SHIPTO (Input, 2048 bytes, indexed):
- Ship-to address file, retrieves alternate pricing flags (
CSALTO
).
- Ship-to address file, retrieves alternate pricing flags (
- GSCONT (Input, 512 bytes, indexed):
- Contract file, retrieves warehouse information (
GXWHSE
).
- Contract file, retrieves warehouse information (
- GSTABL (Input, 256 bytes, indexed):
- Table file, retrieves container (
CNTRCD
) and product (PRODCD
) descriptions, gravity (TBGRAV
), and other attributes.
- Table file, retrieves container (
- GSPRCT (Input, 256 bytes, indexed, MG48):
- Product characteristics file, retrieves additional product details.
- GSCTUM (Input, 64 bytes, indexed):
- Unit of measure conversion file, retrieves conversion factors (
CUCVFA
) and issue units (CUIUM
, VV04).
- Unit of measure conversion file, retrieves conversion factors (
- BICONT (Input, 256 bytes, indexed):
- Company control file, retrieves company name (
BCNAME
).
- Company control file, retrieves company name (
- GSHAZM (Input, 384 bytes, indexed, JB05):
- Hazardous materials file, retrieves hazmat descriptions (
HMSHD1
–HMSHD4
).
- Hazardous materials file, retrieves hazmat descriptions (
- BBFRPR (Input, 256 bytes, indexed, JB05):
- Freight processor file, retrieves processor details (
FPNAME
,FPADR1
,FPCTRY
,FPFPTY
).
- Freight processor file, retrieves processor details (
- BBSRNH (Update, 128 bytes, indexed, JB14):
- Shipping reference number file, updated with order and freight processor details.
- CUADR (Input, 448 bytes, indexed, JB14):
- Customer address file, retrieves EDI address details (
CDNAME
,CDADR1
,CDCTY
).
- Customer address file, retrieves EDI address details (
- SHPADR (Update, 448 bytes, indexed, JB14):
- Shipment address file, updated with order-specific addresses (
SDNAME
,SDADR1
,SDZIP
).
- Shipment address file, updated with order-specific addresses (
- EDICUS (Input, 384 bytes, indexed, JB14):
- EDI customer file, retrieves shipper details for EDI
'856'
orders (EISHNM
,EISHA1
).
- EDI customer file, retrieves shipper details for EDI
- BBASND (Input, 512 bytes, indexed, JB15):
- Advance ship notice file, retrieves vendor part (
SDVPPT
), buyer part (SDBYPT
), and batch number (SDBTCH
).
- Advance ship notice file, retrieves vendor part (
- BBORF (Input, 640 bytes, indexed, MG29):
- Freight table file, retrieves freight table count (
BFFTCN
) for traffic report.
- Freight table file, retrieves freight table count (
- GSMLCD (Input, 296 bytes, indexed, JB37):
- Major location code file, retrieves loading location descriptions (
GMMLDS
,GMLOD1
–GMLOD3
).
- Major location code file, retrieves loading location descriptions (
- ARCUFMX (Input, 266 bytes, indexed):
- Customer format file, retrieves email addresses (
EIFM
array) for confirmations.
- Customer format file, retrieves email addresses (
- GSCNTR1 (Input, 512 bytes, indexed, JK03):
- Container file, replaces
GSCNTR
for container code lookup.
- Container file, replaces
- BBCAID (Input, 200 bytes, indexed, JK04):
- Carrier ID file, replaces
BBCAID
type inGSTABL
for carrier lookup.
- Carrier ID file, replaces
- GSPROD (Input, 512 bytes, indexed, JK05):
- Product file, replaces
PRODCD
type inGSTABL
for product lookup.
- Product file, replaces
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¶
- MSHPADR (DC02, JB26):
- Retrieves compressed ship-to addresses, passing company, order, customer, ship-to, and country code (
SDCTY
). - MINLBGL1 (JB31):
- 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.