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:
- Program Initialization:
- Header (H) Specification (Line 0002):
- Defines the program name (
BB751) with optionP064(possibly a program version or parameter). Bindicates batch processing mode.
- Defines the program name (
- File Specifications (F) (Lines 0004–0009):
BBBOL: Input file (512 bytes), primary file for BOL header data, sorted by#GSORTinBB751.ocl36.txt(renamed fromBB751S).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.
-
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) andBORDNO(positions 4–9,L1). BORSEQ(positions 10–12) is'000'due to the sort filter inBB751.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).
-
Control Logic (C Specifications):
- Initialization (Lines 0062–0072):
ONCE IFEQ 0: Ensures one-time initialization.ADD 1 ONCE: IncrementsONCE(20 bytes) to prevent re-execution.TIME TIMDAT: Gets system time and date intoTIMDAT(12 bytes).MOVELTIMDAT TIME: Moves time toTIME(6 bytes, format HH:MM:SS).MOVE TIMDAT DATE: Moves date toDATE(6 bytes).
- Company Lookup (Line 0077):
L2 BOCO CHAINBICONT 93: Chains toBICONTusingBOCO(company number) as the key. Sets indicator 93 if the company record is not found.
-
Customer Lookup (Lines 0082–0084):
L1 MOVELBOCO ARKEY: Moves company number (BOCO) toARKEY(8-byte key).L1 MOVE BOCUST ARKEY: Appends customer number (BOCUST) toARKEY.L1 ARKEY CHAINARCUST 52: Chains toARCUSTusingARKEY. Sets indicator 52 if the customer record is not found.
-
Report Output (O Specifications) (Lines 0086–0145):
-
Outputs to the
LISTprinter 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 (DATEin YY/MM/DD format). - Report Title (D 2 L2, OR OFNL2):
- Prints “OPEN ORDERS BY ORDER NO SUMMARY” and time (
TIMEin 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.
-
Program Flow:
- Reads
BBBOLheader records sequentially (sequence'000'due to sort). - Uses level breaks:
L2for company (BOCO) andL1for order (BORDNO). - Retrieves company name (
BCNAME) fromBICONTand customer name (ARNAME) fromARCUST. - Outputs a summarized report with order-level data, excluding detail lines or remarks.
Business Rules¶
- Data Filtering:
- Processes only header records with sequence number
'000'(enforced by the sort inBB751.ocl36.txt). -
Excludes deleted records (
BODEL = 'D'), as enforced by the sort. -
Company and Customer Validation:
- Validates company number (
BOCO) againstBICONT. If not found, indicator 93 is set, andBCNAMEis omitted. -
Validates customer number (
BOCUST) againstARCUSTusingARKEY(company + customer). If not found, indicator 52 is set, andARNAMEis omitted. -
Report Structure:
- Groups output by company (
L2) and order (L1). - Includes only header-level data: order number, customer number, customer name, railcar number, order date, PO number, and request date.
-
Omits detail lines (e.g., items, quantities) and remarks, unlike
BB750. -
Formatting:
- Uses fixed-width columns (132 bytes) with asterisk separators for readability.
- Formats dates in YY/MM/DD (
BORQDTY,BOPODTY,BOORDTY) and time in HH:MM:SS (TIME). -
Includes system date (
DATE) and time (TIME) in the report header. -
Summary Focus:
- 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¶
- BBBOL:
- Primary input file (512 bytes), sorted by
#GSORTinBB751.ocl36.txt(renamed fromBB751S). - 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. -
Used for order-level data in the report.
-
ARCUST:
- Indexed customer file (384 bytes, 8-byte key).
- Used to retrieve customer name (
ARNAME) for the report. -
Key:
ARKEY(company + customer number). -
BICONT:
- Indexed inventory control file (256 bytes, 2-byte key).
- Used to retrieve company name (
BCNAME) for the report header. -
Key:
BOCO(company number). -
LIST:
- Output printer file (132 bytes).
- Used to generate the formatted summary report with company headers, order data, and separators.
External Programs Called¶
- None:
- Unlike
BB750.rpg36.txt, which callsMSHPADRfor ship-to address formatting,BB751does 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
BB751RPG 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
BBBOLheader records with level breaks (L2for company,L1for order). - Retrieves company name (
BCNAME) fromBICONTand customer name (ARNAME) fromARCUST. - 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!