Skip to content

The call stack provided consists of three programs: BI947P.ocl36.txt (OCL), BI947P.rpgle.txt (RPG for input validation), and BI947.ocl36.txt with BI947.rpgle.txt (OCL and RPG for sorting and report generation). These programs work together to produce a "Customer Freight Table List by Carrier ID." Below, I will identify the use cases implemented by this call stack and then provide a function requirement document for one use case, assuming it operates as a large function with direct inputs instead of screen interaction.


Use Cases Implemented by the Call Stack

The call stack implements the following use cases, each representing a distinct business process supported by the programs:

  1. Generate Freight Table Report by Carrier ID (All Companies, All Carriers):
  2. Description: Produces a report listing all freight table records sorted by carrier ID for all companies, including customer details, rates, surcharges, and carrier-specific costs.
  3. Inputs: Selection for all companies (KYALCO='ALL'), all carriers (KYALCS='ALL'), job queue flag (KYJOBQ), copy count (KYCOPY), and optional current records flag (KYCUR).
  4. Process: Validates inputs, sorts the freight table (BICUFR) by carrier ID, retrieves related data (customer, ship-to, carrier), calculates freight amounts, and outputs a formatted report (list164) and optionally a disk file (FR947XL) for logistics analysis.
  5. Output: Printed report and disk file with freight details.

  6. Generate Freight Table Report for Specific Companies (All Carriers):

  7. Description: Produces a report for specific company numbers (KYCO1, KYCO2, KYCO3) and all carriers, including freight rates and surcharges.
  8. Inputs: Specific company numbers (KYALCO='CO', KYCO1–3), all carriers (KYALCS='ALL'), job queue flag, copy count, and current records flag.
  9. Process: Validates company numbers against BICONT, sorts BICUFR for selected companies, retrieves related data, calculates freight, and generates report outputs.
  10. Output: Printed report and disk file filtered by company.

  11. Generate Freight Table Report for Specific Carriers (All Companies):

  12. Description: Produces a report for all companies but specific carrier IDs (CS array), focusing on selected carriers’ freight details.
  13. Inputs: All companies (KYALCO='ALL'), specific carrier IDs (KYALCS='SEL', CS), job queue flag, copy count, and current records flag.
  14. Process: Validates carrier IDs, sorts BICUFR by carrier ID, retrieves related data, calculates freight, and generates report outputs.
  15. Output: Printed report and disk file filtered by carrier.

  16. Generate Freight Table Report for Specific Companies and Carriers:

  17. Description: Produces a report for specific company numbers and specific carrier IDs, providing a targeted view of freight agreements.
  18. Inputs: Specific company numbers (KYALCO='CO', KYCO1–3), specific carrier IDs (KYALCS='SEL', CS), job queue flag, copy count, and current records flag.
  19. Process: Validates company and carrier inputs, sorts BICUFR for the selected subset, retrieves related data, calculates freight, and generates report outputs.
  20. Output: Printed report and disk file for the specified companies and carriers.

  21. Generate Freight Table Report for Current Records Only:

  22. Description: Filters the freight table to include only records within valid start and end dates (KYCUR='CUR'), for any combination of companies and carriers.
  23. Inputs: KYALCO, KYCO1–3, KYALCS, CS, KYJOBQ, KYCOPY, and KYCUR='CUR'.
  24. Process: Validates inputs, filters BICUFR for current records (based on BFSTD8 and BFEXD8), sorts, retrieves related data, calculates freight, and generates report outputs.
  25. Output: Printed report and disk file with current records only.

  26. Batch Processing of Freight Table Report:

  27. Description: Submits the report generation to a job queue for batch processing, allowing asynchronous execution for large datasets.
  28. Inputs: Same as above use cases, with KYJOBQ='Y'.
  29. Process: Validates inputs, submits the sort and report generation (BI947) to the job queue, and produces outputs without immediate user interaction.
  30. Output: Same as above, processed in batch mode.

  31. Logistics Analysis Data Export:

  32. Description: Generates a disk file (FR947XL) with detailed freight data for logistics analysis, alongside the printed report.
  33. Inputs: Same as above use cases, with output to FR947XL enabled.
  34. Process: Includes additional output to FR947XL with fields like rates, surcharges, and freight totals for analysis.
  35. Output: Disk file (FR947XL) alongside the printed report.

Function Requirement Document

Function Name: GenerateFreightTableReport

Purpose: Generate a comprehensive freight table report sorted by carrier ID, including customer details, freight rates, surcharges, and carrier-specific costs, with optional filtering by company, carrier, and current records, and output to both a printed report and a disk file for logistics analysis.

Inputs: - company_selection (string): 'ALL' or 'CO' (specific companies). - company_numbers (array of integers): Up to three company numbers (if company_selection='CO'). - carrier_selection (string): 'ALL' or 'SEL' (specific carriers). - carrier_ids (array of strings): Up to 10 carrier IDs (if carrier_selection='SEL'). - current_records_only (string): 'CUR' or blank (to filter by valid start/end dates). - job_queue (string): 'Y' or 'N' (for batch processing). - copy_count (integer): Number of report copies (minimum 1).

Outputs: - Printed report (list164): Formatted report with headers and detail lines. - Disk file (FR947XL): Structured data for logistics analysis.

Function Requirement: GenerateFreightTableReport

Purpose

Generate a freight table report sorted by carrier ID, including customer details, freight rates, surcharges, and carrier costs, with optional filtering by company, carrier, and current records, outputting to a printed report and a disk file for logistics analysis.

Inputs

  • company_selection (string): 'ALL' (all companies) or 'CO' (specific companies).
  • company_numbers (array of integers): Up to three company numbers (if company_selection='CO').
  • carrier_selection (string): 'ALL' (all carriers) or 'SEL' (specific carriers).
  • carrier_ids (array of strings): Up to 10 carrier IDs (if carrier_selection='SEL').
  • current_records_only (string): 'CUR' (filter by valid start/end dates) or blank.
  • job_queue (string): 'Y' (batch processing) or 'N' (immediate).
  • copy_count (integer): Number of report copies (minimum 1).

Outputs

  • Printed Report (list164): Formatted report with headers (report title, company name, date, time, carrier name) and detail lines (customer number, ship-to, location, container code, product codes, rates, surcharges, freight totals).
  • Disk File (FR947XL): Structured data with freight rates, surcharges, and totals for logistics analysis.

Process Steps

  1. Validate Inputs:
  2. Ensure company_selection is 'ALL' or 'CO'. If 'CO', validate company_numbers against BICONT (non-deleted records).
  3. Ensure carrier_selection is 'ALL' or 'SEL'. If 'SEL', validate carrier_ids (non-blank).
  4. Ensure current_records_only is 'CUR' or blank.
  5. Ensure job_queue is 'Y' or 'N'.
  6. Set copy_count to 1 if zero or invalid.
  7. Clear Temporary Files:
  8. Delete or clear FRTRAT, BICUFRO, FR947XL to ensure fresh data.
  9. Sort Freight Data:
  10. Sort BICUFR by company number and carrier ID, excluding deleted records (BFDEL ≠ 'D').
  11. Filter by company_numbers (if company_selection='CO') and carrier_ids (if carrier_selection='SEL').
  12. If current_records_only='CUR', include only records with valid start/end dates (BFSTD8 to BFEXD8).
  13. Output sorted data to BI947S.
  14. Retrieve Related Data:
  15. Fetch company names from BICONT.
  16. Fetch customer names and zip codes from ARCUST and SHIPTO.
  17. Fetch carrier names from BBCAID.
  18. Calculate Freight:
  19. Call MBBFRT with parameters (company, customer, ship-to, carrier ID, product codes, etc.) to compute freight amounts (f$btot, f$ctot), surcharges (e.g., fuel, insurance), and carrier costs.
  20. Generate Outputs:
  21. Printed Report (list164):
    • Print headers for each carrier ID, including report title, company name, date, time, and carrier name.
    • Print detail lines with customer number, ship-to, location, container code, product codes, rates (per mile, hundredweight, gallon, unit), surcharges (cleaning, pump, hose, etc.), and freight totals.
    • Handle page breaks on carrier change or overflow.
  22. Disk File (FR947XL):
    • Write fields like rates, surcharges, carrier codes, customer name, and freight totals for logistics analysis.
  23. Batch Processing (if job_queue='Y'):
  24. Submit sorting and report generation to the job queue for asynchronous execution.
  25. Cleanup:
  26. Reset switches and clear local variables.

Business Rules

  • Input Validation:
  • company_selection must be 'ALL' or 'CO'.
  • company_numbers must exist in BICONT and not be deleted (BCDEL ≠ 'D').
  • carrier_selection must be 'ALL' or 'SEL'.
  • carrier_ids must be non-blank if carrier_selection='SEL'.
  • current_records_only must be 'CUR' or blank.
  • job_queue must be 'Y' or 'N'.
  • copy_count defaults to 1 if invalid.
  • Data Filtering:
  • Exclude deleted records (BFDEL ≠ 'D').
  • Filter by company_numbers if company_selection='CO'.
  • Filter by carrier_ids if carrier_selection='SEL'.
  • Filter by current records if current_records_only='CUR' (within valid dates).
  • Freight Calculations:
  • Use MBBFRT to calculate freight amounts (f$btot, f$ctot) based on rates (per mile, hundredweight, gallon, unit), surcharges (fuel, cleaning, pump, etc.), and insurance percentages.
  • Display surcharges separately on invoices if specified (BFSCSP).
  • Report Formatting:
  • Group by carrier ID with headers.
  • Include customer, ship-to, location, container code, product codes, rates, and surcharges.
  • Show carrier-specific rates and cost differences (BFACDF).
  • Output:
  • Generate copy_count printed reports.
  • Write logistics data to FR947XL if enabled.

Calculations

  • Freight Amounts (f$btot, f$ctot):
  • Computed by MBBFRT using inputs like company number, customer number, ship-to, carrier ID, quantity, and rates (e.g., BFRPM, BFCWT, BFRPUM).
  • Include surcharges (e.g., fuel: f$SCAM, insurance: f$INAM, carrier equivalents).
  • Surcharges:
  • Fuel surcharge (f$SCAM): Based on BFSCHG and f$SCPC (percentage).
  • Insurance amount (f$INAM): Based on BFINSP (percentage).
  • Similar calculations for carrier-specific surcharges (f$CSCAM, f$CINAM).


Notes

  • The function assumes direct input parameters, replacing the interactive screen (SCREEN in BI947P.rpgle.txt) with a structured input format.
  • The use cases cover all combinations of company and carrier filtering, current records, and batch processing, as implemented in the call stack.
  • The truncation of BI947.rpgle.txt limits visibility into the exact calculation logic (e.g., MBBFRT call), but the data structures and context provide sufficient detail for the requirements.
  • If additional details (e.g., full BI947.rpgle.txt or MBBFRT logic) are available, I can refine the calculations or process steps further.