Skip to content

BB751 RPG36

The document BB751.rpg36.txt is an RPG/36 program for the IBM System/36 or AS/400, responsible for generating a Summary Open Railcar Bill of Lading (BOL) Listing by Order. It is called by the OCL program BB751.ocl36.txt when a summary report is requested (i.e., when the KYDETL flag is not 'Y' in BB750P.rpg36.txt). This program processes sorted BOL header records (filtered for sequence '000') and produces a summarized report without detail lines or remarks. Below, I’ll explain the process steps, business rules, tables/files used, and external programs called.


Process Steps of the RPG Program

The BB751 RPG program processes BOL header records from a sorted file (BB751S, renamed as BBBOL) and generates a summary report using data from reference files (ARCUST, BICONT). It outputs a formatted report to a printer file (LIST) with order-level information. Here’s a step-by-step breakdown:

  1. Program Initialization:
  2. Header (H) Specification (Line 0002):
    • Defines the program name (BB751) with option P064 (possibly a program version or parameter).
    • B indicates batch processing mode.
  3. File Specifications (F) (Lines 0004–0009):
    • BBBOL: Input file (512 bytes), primary file for BOL header data, sorted by #GSORT in BB751.ocl36.txt (renamed from BB751S).
    • ARCUST: Indexed customer file (384 bytes, 8-byte key), used for customer data.
    • BICONT: Indexed inventory control file (256 bytes, 2-byte key), used for company data.
    • LIST: Output printer file (132 bytes), used to generate the summary report.
  4. Input Specifications (I):

    • Header Record (NS 01) (Lines 0011–0054):
    • Defines fields for the header record, including company number (BOCO), order number (BORDNO), sequence number (BORSEQ), customer number (BOCUST), ship-to number (BOSHIP), dates (BORQDT, BOPODT, BOORDT), railcar number (BOCAR#), carrier code (BOCACD), freight code (BOFRCD), and others.
    • Key fields for level breaks: BOCO (positions 2–3, L2) and BORDNO (positions 4–9, L1).
    • BORSEQ (positions 10–12) is '000' due to the sort filter in BB751.ocl36.txt.
    • Customer File (ARCUST NS) (Line 0056):
    • Defines ARNAME (customer name, positions 10–39).
    • Company File (BICONT NS) (Line 0057):
    • Defines BCNAME (company name, positions 4–33).
  5. Control Logic (C Specifications):

  6. Initialization (Lines 0062–0072):
    • ONCE IFEQ 0: Ensures one-time initialization.
    • ADD 1 ONCE: Increments ONCE (20 bytes) to prevent re-execution.
    • TIME TIMDAT: Gets system time and date into TIMDAT (12 bytes).
    • MOVELTIMDAT TIME: Moves time to TIME (6 bytes, format HH:MM:SS).
    • MOVE TIMDAT DATE: Moves date to DATE (6 bytes).
  7. Company Lookup (Line 0077):
    • L2 BOCO CHAINBICONT 93: Chains to BICONT using BOCO (company number) as the key. Sets indicator 93 if the company record is not found.
  8. Customer Lookup (Lines 0082–0084):

    • L1 MOVELBOCO ARKEY: Moves company number (BOCO) to ARKEY (8-byte key).
    • L1 MOVE BOCUST ARKEY: Appends customer number (BOCUST) to ARKEY.
    • L1 ARKEY CHAINARCUST 52: Chains to ARCUST using ARKEY. Sets indicator 52 if the customer record is not found.
  9. Report Output (O Specifications) (Lines 0086–0145):

  10. Outputs to the LIST printer file (132 bytes) with formats grouped by company (L2) and order (L1):

    • Company Header (D 103 L2, OR OFNL2):
    • Prints company name (BCNAME) if found (not indicator 93).
    • Prints “RAIL CAR”, page number (PAGE), and date (DATE in YY/MM/DD format).
    • Report Title (D 2 L2, OR OFNL2):
    • Prints “OPEN ORDERS BY ORDER NO SUMMARY” and time (TIME in HH:MM:SS format).
    • Column Headings (D 1 L2, OR OFNL2):
    • Prints asterisk separators and column labels: “ORDER NO”, “CUST NO”, “CUSTOMER NAME”, “RAIL CAR”, “ORDER DATE”, “P/O NO”, “REQUEST DATE”.
    • Order Data (D 1 L1):
    • Prints order number (BORDNO), customer number (BOCUST), customer name (ARNAME), railcar number (KRCCAR), order date (BOORDT), PO number (BOPORD), and request date (BORQDT).
    • Total Line (T 1 L1):
    • Prints a blank line for separation at the end of each order.
  11. Program Flow:

  12. Reads BBBOL header records sequentially (sequence '000' due to sort).
  13. Uses level breaks: L2 for company (BOCO) and L1 for order (BORDNO).
  14. Retrieves company name (BCNAME) from BICONT and customer name (ARNAME) from ARCUST.
  15. Outputs a summarized report with order-level data, excluding detail lines or remarks.

Business Rules

  1. Data Filtering:
  2. Processes only header records with sequence number '000' (enforced by the sort in BB751.ocl36.txt).
  3. Excludes deleted records (BODEL = 'D'), as enforced by the sort.

  4. Company and Customer Validation:

  5. Validates company number (BOCO) against BICONT. If not found, indicator 93 is set, and BCNAME is omitted.
  6. Validates customer number (BOCUST) against ARCUST using ARKEY (company + customer). If not found, indicator 52 is set, and ARNAME is omitted.

  7. Report Structure:

  8. Groups output by company (L2) and order (L1).
  9. Includes only header-level data: order number, customer number, customer name, railcar number, order date, PO number, and request date.
  10. Omits detail lines (e.g., items, quantities) and remarks, unlike BB750.

  11. Formatting:

  12. Uses fixed-width columns (132 bytes) with asterisk separators for readability.
  13. Formats dates in YY/MM/DD (BORQDTY, BOPODTY, BOORDTY) and time in HH:MM:SS (TIME).
  14. Includes system date (DATE) and time (TIME) in the report header.

  15. Summary Focus:

  16. The report is summarized by order, focusing on header information without item-level details, making it more concise than the detailed report (BB750).

Tables/Files Used

  1. BBBOL:
  2. Primary input file (512 bytes), sorted by #GSORT in BB751.ocl36.txt (renamed from BB751S).
  3. Contains header records with fields like company (BOCO), order number (BORDNO), sequence (BORSEQ = '000'), customer (BOCUST), ship-to (BOSHIP), railcar (BOCAR#, KRCCAR), dates, and PO numbers.
  4. Used for order-level data in the report.

  5. ARCUST:

  6. Indexed customer file (384 bytes, 8-byte key).
  7. Used to retrieve customer name (ARNAME) for the report.
  8. Key: ARKEY (company + customer number).

  9. BICONT:

  10. Indexed inventory control file (256 bytes, 2-byte key).
  11. Used to retrieve company name (BCNAME) for the report header.
  12. Key: BOCO (company number).

  13. LIST:

  14. Output printer file (132 bytes).
  15. Used to generate the formatted summary report with company headers, order data, and separators.

External Programs Called

  • None:
  • Unlike BB750.rpg36.txt, which calls MSHPADR for ship-to address formatting, BB751 does not call any external programs.
  • The program relies entirely on internal logic and file access (BBBOL, ARCUST, BICONT) to generate the report.

Summary

  • Purpose: The BB751 RPG program generates a summary Open Railcar BOL Listing by Order, processing sorted BOL header records (BBBOL, sequence '000') and enriching them with company (BICONT) and customer (ARCUST) data to produce a concise report (LIST).
  • Process Flow:
  • Initializes system date (DATE) and time (TIME) once.
  • Processes BBBOL header records with level breaks (L2 for company, L1 for order).
  • Retrieves company name (BCNAME) from BICONT and customer name (ARNAME) from ARCUST.
  • Outputs a summary report with order-level data (order number, customer, railcar, dates, PO).
  • Business Rules:
  • Processes only header records (sequence '000') and excludes deleted records.
  • Validates company and customer data, omitting names if not found.
  • Groups output by company and order, focusing on summary-level data without details or remarks.
  • Files Used: BBBOL (input BOL headers), ARCUST (customer), BICONT (company), LIST (output report).
  • External Programs: None.

Key Differences from BB750: - BB751 processes only header records (sequence '000'), while BB750 includes detail and remark records. - BB751 uses fewer files (excludes SHIPTO, GSCONT, GSCTUM) and does not call MSHPADR. - BB751 produces a narrower report (132 bytes vs. 164 bytes for BB750) with no item-level details.

If you have file layouts for BBBOL, ARCUST, or BICONT, I can provide further details on field mappings or report content!