The query refers to the "entire call stack" and "these programs," which, based on the conversation history, likely pertains to the BB110.rpg36.txt RPG program and its caller BB110P.ocl36 on an IBM System/36, as described previously. The BB110 program generates various reports (picking tickets, order confirmations, proforma invoices, traffic reports) and updates order-related data, while BB110P handles batch selection and validation before calling BB110. Below, I’ll list the use cases implemented across these programs and provide a concise functional requirements document for one use case, treating it as a large function that processes inputs without screen interaction.
Use Cases Implemented by BB110 and BB110P¶
The combined functionality of BB110P (batch selection and validation) and BB110 (report generation and data updates) supports the following use cases, derived from the program descriptions and modifications:
- Select and Validate Orders for Processing (BB110P):
-
Selects orders in batch mode, validates them (e.g., checks for EDI errors, deletion status), and passes valid orders to
BB110for report generation. -
Generate Picking Ticket (BB110, LIST):
-
Produces standard picking tickets, including an EDI Viscosity version (JB15, JB18), with order details, quantities, weights, and dispatch marks.
-
Generate Packaging Plant Pick Sheet (BB110, LIST2):
-
Creates pick sheets for the packaging plant (JB19, JB20, JK02), with size, brand, description, quantity, gross weight, and gallons.
-
Generate Order Confirmation (BB110, LIST3):
-
Prints order confirmations (MG41) with customer/ship-to details, payment terms, Incoterms, totals, and standard notes, skipping credit checks (MG64).
-
Generate Proforma Invoice (BB110, LIST4):
-
Generates proforma invoices (MG64) with order details, totals, and Incoterms, formatted for pre-invoicing purposes.
-
Generate Traffic Report (BB110, TRAFFP):
-
Produces a traffic report (MG29) listing orders with multiple freight tables, including order number, customer, carrier, and requested date.
-
Update Order and Shipment Data (BB110):
- Updates files (
BBOTHS1,BBORTU,BBOTDS1,BBSRNH,SHPADR) with freight details, product descriptions, and statuses for downstream processing.
Functional Requirements Document: Generate Order Confirmation (LIST3)¶
The “Generate Order Confirmation” use case is selected as it represents a core customer-facing output of BB110, incorporating complex business rules, calculations, and file updates, while aligning with the batch processing initiated by BB110P. The function processes inputs programmatically, producing a formatted report without screen interaction.
Functional Requirements Document: Generate Order Confirmation¶
Overview¶
The GenerateOrderConfirmation function generates a formatted order confirmation report (LIST3) for a validated order, including customer details, product details, totals, and standard notes. It processes inputs from order-related files, applies business rules, and produces a printed report and file updates, initiated after batch validation by BB110P.
Inputs¶
- Order Header Data (
BBORTR): Order number (BORDNO), company (BOCO), customer (BOCUST), ship-to (BOSHIP), requested date (BORQDT), PO numbers (BOPORD,BOSHPD), salesman (BOSLMN), contact (BOCNCT), order taker (BOTKBY), delivery time (BODLTM), order status (BOORPR), freight processor (BOFPCD), freight processor status (BOFPST), version number (BOVERN), Incoterms (BOINCT), payment terms (BOTERM), routing codes (BORTG1,BORTG2), carrier code (BOCACD). - Order Detail Data (
BBOTDS1): Quantity (BDQTY), gross weight (BDGWT), product weight (BDPRWT), product code (BDPROD), container code (BDCNTR), location (BDLOC), descriptions (PPDSC1–PPDSC3), unit of measure (PPUMBP). - Customer Data (
ARCUST,CUADR): Customer name (ARNAME), address (ARADR1–ARADR4), EDI address (CDNAME,CDADR1–CDADR2,CDCITY,CDST,CDZIPN,CDCTY). - Ship-to Data (
SHIPTO,SHPADR): Ship-to address (SDNAME,SDADR1–SDADR2,SDCITY,SDST,SDZIP,SDCTY), alternate pricing flag (CSALTO). - Freight Processor Data (
BBFRPR): Name (FPNAME), address (FPADR1–FPADR2,FPCITY,FPSTAT,FPZIP,FPCTRY), type (FPFPTY). - Product and Container Data (
GSTABL,GSCNTR1,GSPROD,GSCTUM): Product/container descriptions (TBDES2,TBSHDS), conversion factors (CUCVFA), issue unit (CUIUM). - Location Data (
GSMLCD): Location description (GMMLDS), loading locations (GMLOD1–GMLOD3). - Email Data (
ARCUFMX): Confirmation email addresses (EIFMarray). - Remarks Data (
BBORTO,BBOTA1): Order remarks (BXOMK1–BXOMK4), dispatch marks (BXDSP1–BXDSP4). - System Data: System date (
SYSDATY), time (SYSTIM). - Validation Status (from
BB110P): Confirmation that order is valid (not markedBODEL = 'E'or'D'unless sent to internal freight processor).
Outputs¶
- LIST3 Report (132-character printer output, U6):
- Header: Company name, order number, customer, ship-to, salesman, date/time.
- Customer/Ship-to: Sold-to/ship-to names, addresses, country.
- Order Details: Ship date, delivery time, contact, order taker, carrier, routing codes, PO numbers, payment terms, Incoterms, loading locations.
- Detail Lines: Size, brand, product description, quantity, gross weight, unit of measure, price, extended price.
- Totals: Net quantity, gross weight, net weight, miscellaneous charges, price total, freight amount.
- Notes: Standard terms/conditions (
NTEarray). - Updated Files:
BBOTHS1: Freight description (BOFRDS), carrier (BOTRAN), freight bill address (BOFRNM,BOFRA1–BOFRA2).BBOTDS1: Product descriptions (PPDSC1–PPDSC3), size, weights.BBORTU: Pick list printed flag (BOPPIK = 'Y'), freight processor status (BOFPST), version number (BOVERN).SHPADR: Shipment addresses.BBSRNH: Shipping reference numbers.
Process Steps¶
- Validate Inputs (from
BB110P): - Confirm order is valid (not
BODEL = 'E'or'D'unless internal freight processor). -
Initialize variables, clear fields (e.g.,
HAZMAT,PPDSC1–PPDSC3), set system date/time. -
Retrieve Order Data:
- Chain to
BBORTRusingBOCO,BORDNOfor header data. -
Mark order as “PRELIMINARY” or “FINAL” based on
BOORPR = 'R'or'C'. -
Retrieve Customer and Ship-to Data:
- Chain to
ARCUSTfor customer name/address. - Call
MSHPADRfor ship-to address (SDNAME,SDADR1, etc.), passingSDCTY. -
Chain to
EDICUSfor EDI'856'shipper details if applicable. -
Retrieve Freight Processor Data:
- Chain to
BBFRPRusingBOFPCD. - Use customer address (
FRNML,FRA1L) for internal processors (FPFPTY ≠ 'EXT'); else useFPNAME,FPADR1. -
Update
BBOTHS1with freight/carrier details. -
Process Detail Lines:
- Chain to
BBOTDS1, skipBDDEL = 'D'. - Retrieve product descriptions (
TBDES2fromGSPROD,CPCPDSfromARCUPR). - Chain to
GSCNTR1for container descriptions,GSCTUMfor unit conversions. -
Calculate extended price:
EXTPRCJB = BDQTY * NEWPRCJ. -
Calculate Totals:
- Net quantity (
L2CQT): SumBDQTY. - Gross weight (
L2GWT): SumBDGWT. - Net weight (
L2NWT): SumBDPRWT. - Total price (
TOTPRCJB): SumBDQTY * NEWPRCJ. - Freight (
L2FRT): SumBDFRRTand accessorials. -
Gallons (
L2NGAL): Convert usingMINLBGL1, handle container420(quarts). -
Retrieve Remarks and Marks:
- Chain to
BBORTO,BBOTA1for remarks (BXOMK1–BXOMK4), dispatch marks (BXDSP1–BXDSP4) ifBADSPH = 'Y'. -
Chain to
ARCUFMXfor email addresses (EIFM). -
Generate Report:
- Print header: Company, order number, customer, ship-to, salesman, date/time.
- Print sold-to/ship-to addresses, ship date, delivery time, contact, carrier, routing, PO numbers, payment terms (
BOTERMwithARTDSC), Incoterms. - Print detail lines: Size, brand, description, quantity, gross weight, unit, price, extended price.
- Print totals: Net quantity, weights, charges, price, freight.
-
Print freight bill address and standard notes (
NTE). -
Update Files:
- Update
BBOTHS1,BBOTDS1,BBORTU,SHPADR,BBSRNH. - Set
BOPPIK = 'Y', updateBOFPST,BOVERN. - Release record locks in
SHPADR,BBOTHS1.
Business Rules¶
- Order Validation:
- Skip orders with
BODEL = 'E'(EDI error) or'D'(deleted) unless internal freight processor. - Treat
BOORPR = 'R'as'C'for final confirmation. -
Mark
BOORPR = 'H'orders as “ON HOLD - DO NOT SHIP”. -
Freight Processing:
- Internal processors (
FPFPTY ≠ 'EXT'): Use customer address. - External processors: Use freight processor address.
-
Include freight bill address for third-party freight.
-
Calculations:
- Net quantity: Sum
BDQTYfor non-deleted lines. - Gross weight: Sum
BDGWT. - Net weight: Sum
BDPRWT. - Total price: Sum
BDQTY * NEWPRCJ. - Freight: Sum
BDFRRTand accessorials. -
Gallons: Convert via
MINLBGL1, special handling for container420(quarts). -
Printing:
- Include payment terms (
ARTDSC), Incoterms, and “FOB SHIPPING POINT” if applicable. - Print loading locations (
GMMLDS,GMLOD1–GMLOD3). - Include up to four email addresses (
EIFM). -
Print standard notes (
NTE) with terms, safety, export rules. -
File Updates:
- Write descriptions to
BBOTDS1(JB51). - Release record locks to prevent conflicts.
- Update
BOPPIK,BOFPST,BOVERN.
External Dependencies¶
- MSHPADR: Retrieves ship-to addresses.
- MINLBGL1: Calculates gallons/pounds for conversions.
Assumptions¶
- Orders are pre-validated by
BB110P. - Required files are accessible and formatted correctly.
- Printer device (
LPRINTER, U6) is available. - No credit limit check for confirmations.
Error Handling¶
- Skip invalid/deleted records.
- Retry missing
ARCUPRrecords with blank/'P'container type. - Log errors for missing file records using indicators.
Notes¶
- Use Case Selection: The “Generate Order Confirmation” use case is chosen for its comprehensive scope, covering data retrieval, calculations, freight handling, and file updates, reflecting the combined workflow of
BB110P(validation) andBB110(report generation). - Function Approach: The function assumes inputs are provided programmatically, with
BB110Pensuring order validity beforeBB110processes the confirmation. - Conciseness: The document focuses on business requirements (e.g., validation, freight logic, printing rules) and key calculations (e.g., totals, unit conversions), summarizing the complex logic from
BB110’s modifications (MG41, JB38, etc.). - Call Stack: Incorporates
BB110P’s role in validating orders andBB110’s role in generating the report and updating files, with external calls toMSHPADRandMINLBGL1.
The document provides a clear, business-focused specification for generating order confirmations, suitable for implementation in a batch processing environment.