Skip to content

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:

  1. Select and Validate Orders for Processing (BB110P):
  2. Selects orders in batch mode, validates them (e.g., checks for EDI errors, deletion status), and passes valid orders to BB110 for report generation.

  3. Generate Picking Ticket (BB110, LIST):

  4. Produces standard picking tickets, including an EDI Viscosity version (JB15, JB18), with order details, quantities, weights, and dispatch marks.

  5. Generate Packaging Plant Pick Sheet (BB110, LIST2):

  6. Creates pick sheets for the packaging plant (JB19, JB20, JK02), with size, brand, description, quantity, gross weight, and gallons.

  7. Generate Order Confirmation (BB110, LIST3):

  8. Prints order confirmations (MG41) with customer/ship-to details, payment terms, Incoterms, totals, and standard notes, skipping credit checks (MG64).

  9. Generate Proforma Invoice (BB110, LIST4):

  10. Generates proforma invoices (MG64) with order details, totals, and Incoterms, formatted for pre-invoicing purposes.

  11. Generate Traffic Report (BB110, TRAFFP):

  12. Produces a traffic report (MG29) listing orders with multiple freight tables, including order number, customer, carrier, and requested date.

  13. Update Order and Shipment Data (BB110):

  14. 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 (PPDSC1PPDSC3), unit of measure (PPUMBP).
  • Customer Data (ARCUST, CUADR): Customer name (ARNAME), address (ARADR1ARADR4), EDI address (CDNAME, CDADR1CDADR2, CDCITY, CDST, CDZIPN, CDCTY).
  • Ship-to Data (SHIPTO, SHPADR): Ship-to address (SDNAME, SDADR1SDADR2, SDCITY, SDST, SDZIP, SDCTY), alternate pricing flag (CSALTO).
  • Freight Processor Data (BBFRPR): Name (FPNAME), address (FPADR1FPADR2, 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 (GMLOD1GMLOD3).
  • Email Data (ARCUFMX): Confirmation email addresses (EIFM array).
  • Remarks Data (BBORTO, BBOTA1): Order remarks (BXOMK1BXOMK4), dispatch marks (BXDSP1BXDSP4).
  • System Data: System date (SYSDATY), time (SYSTIM).
  • Validation Status (from BB110P): Confirmation that order is valid (not marked BODEL = '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 (NTE array).
  • Updated Files:
  • BBOTHS1: Freight description (BOFRDS), carrier (BOTRAN), freight bill address (BOFRNM, BOFRA1BOFRA2).
  • BBOTDS1: Product descriptions (PPDSC1PPDSC3), 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

  1. Validate Inputs (from BB110P):
  2. Confirm order is valid (not BODEL = 'E' or 'D' unless internal freight processor).
  3. Initialize variables, clear fields (e.g., HAZMAT, PPDSC1PPDSC3), set system date/time.

  4. Retrieve Order Data:

  5. Chain to BBORTR using BOCO, BORDNO for header data.
  6. Mark order as “PRELIMINARY” or “FINAL” based on BOORPR = 'R' or 'C'.

  7. Retrieve Customer and Ship-to Data:

  8. Chain to ARCUST for customer name/address.
  9. Call MSHPADR for ship-to address (SDNAME, SDADR1, etc.), passing SDCTY.
  10. Chain to EDICUS for EDI '856' shipper details if applicable.

  11. Retrieve Freight Processor Data:

  12. Chain to BBFRPR using BOFPCD.
  13. Use customer address (FRNML, FRA1L) for internal processors (FPFPTY ≠ 'EXT'); else use FPNAME, FPADR1.
  14. Update BBOTHS1 with freight/carrier details.

  15. Process Detail Lines:

  16. Chain to BBOTDS1, skip BDDEL = 'D'.
  17. Retrieve product descriptions (TBDES2 from GSPROD, CPCPDS from ARCUPR).
  18. Chain to GSCNTR1 for container descriptions, GSCTUM for unit conversions.
  19. Calculate extended price: EXTPRCJB = BDQTY * NEWPRCJ.

  20. Calculate Totals:

  21. Net quantity (L2CQT): Sum BDQTY.
  22. Gross weight (L2GWT): Sum BDGWT.
  23. Net weight (L2NWT): Sum BDPRWT.
  24. Total price (TOTPRCJB): Sum BDQTY * NEWPRCJ.
  25. Freight (L2FRT): Sum BDFRRT and accessorials.
  26. Gallons (L2NGAL): Convert using MINLBGL1, handle container 420 (quarts).

  27. Retrieve Remarks and Marks:

  28. Chain to BBORTO, BBOTA1 for remarks (BXOMK1BXOMK4), dispatch marks (BXDSP1BXDSP4) if BADSPH = 'Y'.
  29. Chain to ARCUFMX for email addresses (EIFM).

  30. Generate Report:

  31. Print header: Company, order number, customer, ship-to, salesman, date/time.
  32. Print sold-to/ship-to addresses, ship date, delivery time, contact, carrier, routing, PO numbers, payment terms (BOTERM with ARTDSC), Incoterms.
  33. Print detail lines: Size, brand, description, quantity, gross weight, unit, price, extended price.
  34. Print totals: Net quantity, weights, charges, price, freight.
  35. Print freight bill address and standard notes (NTE).

  36. Update Files:

  37. Update BBOTHS1, BBOTDS1, BBORTU, SHPADR, BBSRNH.
  38. Set BOPPIK = 'Y', update BOFPST, BOVERN.
  39. Release record locks in SHPADR, BBOTHS1.

Business Rules

  1. Order Validation:
  2. Skip orders with BODEL = 'E' (EDI error) or 'D' (deleted) unless internal freight processor.
  3. Treat BOORPR = 'R' as 'C' for final confirmation.
  4. Mark BOORPR = 'H' orders as “ON HOLD - DO NOT SHIP”.

  5. Freight Processing:

  6. Internal processors (FPFPTY ≠ 'EXT'): Use customer address.
  7. External processors: Use freight processor address.
  8. Include freight bill address for third-party freight.

  9. Calculations:

  10. Net quantity: Sum BDQTY for non-deleted lines.
  11. Gross weight: Sum BDGWT.
  12. Net weight: Sum BDPRWT.
  13. Total price: Sum BDQTY * NEWPRCJ.
  14. Freight: Sum BDFRRT and accessorials.
  15. Gallons: Convert via MINLBGL1, special handling for container 420 (quarts).

  16. Printing:

  17. Include payment terms (ARTDSC), Incoterms, and “FOB SHIPPING POINT” if applicable.
  18. Print loading locations (GMMLDS, GMLOD1GMLOD3).
  19. Include up to four email addresses (EIFM).
  20. Print standard notes (NTE) with terms, safety, export rules.

  21. File Updates:

  22. Write descriptions to BBOTDS1 (JB51).
  23. Release record locks to prevent conflicts.
  24. 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 ARCUPR records 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) and BB110 (report generation).
  • Function Approach: The function assumes inputs are provided programmatically, with BB110P ensuring order validity before BB110 processes 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 and BB110’s role in generating the report and updating files, with external calls to MSHPADR and MINLBGL1.

The document provides a clear, business-focused specification for generating order confirmations, suitable for implementation in a batch processing environment.