BB150P RPG36
The BB150P.rpg36.txt RPG program is a prompt program for the Bill of Lading (BOL) printing process, designed to run on an IBM System/36 or AS/400 environment. It is called by the main OCL (Operation Control Language) procedure to gather and validate user input before invoking the main BOL printing program (BB150). The program handles user input for company selection, order numbers, and shipment reference numbers (SRNs) for single and multi-load orders, ensuring valid data is passed to BB150. Below, I’ll explain the process steps, business rules, tables (files) used, and any external programs called.
Process Steps of the BB150P RPG Program¶
The BB150P program serves as an interactive interface to collect and validate input parameters for BOL printing. It uses a workstation file (SCREEN) to prompt the user and validates inputs against data in the BICONT and BBORTR files. The program also supports multi-load orders by validating SRNs (JB01). Here’s a detailed breakdown of the process steps:
- Initialization:
- The program initializes by setting up the workstation file (
SCREEN) for user interaction and clearing error message fields (MSG35) via theEDITsubroutine. - It sets indicators (
01,U8,LR) to control program flow and ensure proper termination. - If indicator
10is off and11is off, it calls theONETIMsubroutine to set default values for company (KYCO), selection type (KYALSL), job queue (KYJOBQ), and copy counts (KYCOPY,KYCOPB). - Default values include:
KYCO = '10'(company code).KYALSL = 'SEL'(selective order processing).KYJOBQ = 'N'(no job queue).KYCOPY = 01,KYCOPB = 01(one copy for each output).
Purpose: Prepares the program environment and sets default parameters for first-time execution.
- User Input Collection:
- Displays the
SCREENfile (formatBB150PFM) to prompt the user for:- Company code (
KYCO, positions 1–2). - Selection type (
KYALSL, positions 3–5, eitherALLorSEL). - Up to 10 order numbers (
KYORD1–KYORD0, positions 6–65). - Job queue flag (
KYJOBQ, position 66,Y/N/blank). - Copy counts (
KYCOPY, positions 67–68;KYCOPB, positions 69–70). - From and to SRNs (
KYFS,KYTS, positions 71–100 and 101–130 for multi-load orders,JB01).
- Company code (
- Reads user input into the
SCREENfile (NS 01) and stores it in the Local Data Area (LDA, positions 101–300) for coordination withBB150andBB152P.
Purpose: Collects user-specified parameters for BOL printing.
- Input Validation (EDIT Subroutine):
- Company Code Validation:
- Chains to
BICONTusingKYCOto verify the company code exists. - If invalid, sets indicator
20and displays error messageMSG,2("INVALID COMPANY #").
- Chains to
- Selection Type Validation:
- Checks
KYALSLforALLorSEL. - If neither, sets indicator
20and displays error messageMSG,1("INVALID SELECTION ALL / SEL"). - If
ALL, skips order number validation and proceeds to job queue checks.
- Checks
- Order Number Validation:
- For
KYALSL = 'SEL', iterates through the 10 order number fields (KYO,1toKYO,10). - For each non-zero order number:
- Constructs an 11-character key (
KY11) by combiningKYCOand the order number (KYO,X) with trailing zeros (000). - Chains to
BBORTRto verify the order exists. - If invalid, sets indicator
20and displays error messageMSG,3("INVALID ORDER #").
- For
- SRN Validation for Multi-Load Orders (
JB01):- Checks
BOMULO(multi-load flag) inBBORTR: - Single-Load Orders (
BOMULO ≠ 'Y'):- Ensures both
KYFS,XandKYTS,Xare zero. - If either is non-zero, sets indicator
20and displays error messagesMSG,4("FROM SRN MUST BE ZERO") orMSG,5("TO SRN MUST BE ZERO").
- Ensures both
- Multi-Load Orders (
BOMULO = 'Y'):- Ensures both
KYFS,XandKYTS,Xare either zero or both keyed. - If one is zero and the other is not, sets indicator
20and displays error messageMSG,6("BOTH FROM / TO SRN MUST BE KEYED"). - Checks that
KYFS,XandKYTS,Xdo not exceed the total loads (BOTOLO). - If exceeded, sets indicator
20and displays error messageMSG,7("FROM/TO MUST BE LESS THAN LOADS"). - Ensures
KYFS,Xis not greater thanKYTS,X. - If true, sets indicator
20and displays error messageMSG,8("FROM SRN MUST BE LESS THAN TO SRN").
- Ensures both
- Checks
- Job Queue Validation:
- Checks
KYJOBQfor valid values (Y,N, or blank). - If invalid, sets indicator
20but does not display a specific error message (logic assumes program termination).
- Checks
- Copy Count Validation:
- If
KYCOPYis zero, sets it to01. - If
KYCOPBis zero, sets it to01.
- If
Purpose: Validates user inputs to ensure they are correct before passing them to BB150.
- Output and Program Termination:
- If validation fails (indicator
20is on), redisplays theSCREENwith the error message (MSG35) and input fields for correction. - If validation succeeds, writes validated inputs to the LDA and sets indicator
11to indicate completion. - Outputs to
SCREEN(formatBB150PFM) with fields:KYCO,KYALSL,KYORD1–KYORD0,KYJOBQ,KYCOPY,KYCOPB,KYFS,KYTS, andMSG35.
- Sets
U8andLR(Last Record) indicators to terminate the program and pass control back to the OCL.
Purpose: Communicates validated parameters to the main program or prompts the user to correct errors.
Business Rules¶
The BB150P program enforces the following business rules:
1. Company Code:
- Must exist in the BICONT file.
- Invalid company codes trigger an error message ("INVALID COMPANY #").
2. Selection Type:
- Must be ALL (process all orders for the company) or SEL (process specific orders).
- Invalid selections trigger an error message ("INVALID SELECTION ALL / SEL").
3. Order Numbers:
- For SEL, at least one order number (KYO,1–KYO,10) must be valid and exist in BBORTR.
- Invalid order numbers trigger an error message ("INVALID ORDER #").
4. Shipment Reference Numbers (SRNs) (JB01):
- For single-load orders (BOMULO ≠ 'Y'):
- Both KYFS and KYTS must be zero.
- Non-zero values trigger errors ("FROM SRN MUST BE ZERO" or "TO SRN MUST BE ZERO").
- For multi-load orders (BOMULO = 'Y'):
- Both KYFS and KYTS must be zero or both must be keyed.
- Non-zero SRNs must not exceed the total loads (BOTOLO).
- KYFS must not be greater than KYTS.
- Violations trigger errors ("BOTH FROM / TO SRN MUST BE KEYED", "FROM/TO MUST BE LESS THAN LOADS", or "FROM SRN MUST BE LESS THAN TO SRN").
5. Job Queue:
- Must be Y, N, or blank.
- Invalid values prevent program continuation.
6. Copy Counts:
- KYCOPY and KYCOPB default to 01 if zero, ensuring at least one copy is printed.
7. LDA Coordination:
- Input parameters are stored in the LDA (positions 101–300) to ensure consistency with BB150 and BB152P.
Tables (Files) Used¶
The program interacts with the following files:
1. SCREEN (CP, 500 bytes, WORKSTN):
- Workstation file for user input/output, using format BB150PFM.
- Fields: KYCO, KYALSL, KYORD1–KYORD0, KYJOBQ, KYCOPY, KYCOPB, KYFS, KYTS, MSG35.
2. BICONT (IC, 256 bytes):
- Billing container file, used to validate the company code (KYCO).
3. BBORTR (IC, 512 bytes):
- Order transaction file, used to validate order numbers (KYO,X) and check multi-load status (BOMULO, BOTOLO).
Key Fields:
- KYCO (company code), KYALSL (selection type), KYORD1–KYORD0 (order numbers), KYFS/KYTS (from/to SRNs), KYJOBQ (job queue), KYCOPY/KYCOPB (copy counts), BOMULO (multi-load flag), BOTOLO (total loads).
External Programs Called¶
The BB150P program does not explicitly call any external programs. It is designed to collect and validate input, then pass control back to the OCL, which likely invokes BB150 to perform the actual BOL printing.
Summary¶
The BB150P RPG program is a prompt and validation program that:
- Collects user input for company code, selection type, order numbers, SRNs, job queue, and copy counts via the SCREEN workstation file.
- Validates inputs against BICONT (company) and BBORTR (orders), with specific logic for single and multi-load orders (JB01).
- Enforces business rules for valid company codes, selection types, order numbers, SRNs, and copy counts.
- Stores validated inputs in the LDA for use by BB150 and potentially BB152P.
- Displays error messages and redisplays the screen if validation fails.
Files Used: SCREEN, BICONT, BBORTR.
External Programs: None.
If you need further details (e.g., specific field mappings, screen format details, or interaction with BB150), let me know!