BB215 RPG36
The BB215.rpg36.txt
document is an RPG III (System/36 style) program called from the BB101.ocl36.txt
OCL program in an IBM System/36 or AS/400 (now IBM i) environment. Its primary function is to remove lockout conditions from order header records in the BBORDRH
file by clearing the lock status and workstation ID fields. Below is a detailed explanation of the process steps, business rules, tables (files) used, and any external programs called.
Process Steps of the RPG Program¶
The BB215
RPG program processes records from the BBORTR
file to identify order headers and updates the corresponding records in the BBORDRH
file to clear lock-related fields. The steps are as follows:
- Program Initialization:
- The program is defined with a header specification (
H P064
) and identified asBB215
. - It defines two files:
BBORTR
: Input primary file (512 bytes, disk, no indexing specified) for reading order transaction records.BBORDRH
: Update-capable file (512 bytes, record length 512, indexed, key length 11, access mode 2) for order header records.
- Input specifications:
- For
BBORTR
(name specification 01, indicators 10, 11, 12): DefinesBOCOS
(company/order/sequence, positions 2-12). - For
BBORDRH
(name specification 09): No specific fields defined in the provided code, but implied to useBOCOS
as the key.
- For
-
Variables:
LOCK
(1 character): Lock status field.WSID
(2 characters): Workstation ID field.ONCE
(1 digit): Control variable to ensure one-time initialization.
-
Main Processing Logic:
- One-Time Initialization (lines 0015-0019):
- Checks if
ONCE
is zero (IFEQ *ZERO
, indicator B1). - If true, clears
LOCK
andWSID
to blanks and setsONCE
to 1. - Ensures this initialization occurs only once per program execution.
- Checks if
-
Record Processing (lines 0022-0027):
- For each
BBORTR
record (indicator 01), chains toBBORDRH
usingBOCOS
(company/order/sequence, line 0022). - If a matching
BBORDRH
record is found (N90
), updates the record with: LOCK
(position 155) set to blanks.WSID
(positions 156-157) set to blanks.- The update is performed via the
D
(detail) output specification (line 0025), conditional on indicators01
andN90
.
- For each
-
Output Operations:
- The output specification for
BBORDRH
(lines 0025-0027) updates the record:- Writes
LOCK
to position 155. - Writes
WSID
to positions 156-157. - Only executed for matched records (
01N90
).
- Writes
Business Rules¶
The program enforces the following business rules for lockout removal:
- Lock Removal:
- For each order transaction record in
BBORTR
, the corresponding order header record inBBORDRH
is updated to clear the lock status (LOCK
) and workstation ID (WSID
). -
This effectively removes any lockout conditions, making the order header available for further processing.
-
Key Matching:
- The program uses the
BOCOS
field (company/order/sequence, positions 2-12) fromBBORTR
to locate the correspondingBBORDRH
record. -
Updates occur only if a matching record is found (
N90
). -
One-Time Initialization:
-
The
ONCE
variable ensures that the initialization ofLOCK
andWSID
to blanks occurs only once, preventing redundant clearing during program execution. -
No Validation or Error Messaging:
- The program assumes the calling OCL program (
BB101.ocl36.txt
) has validated the batch deletion context (e.g.,SWITCH1-1
). - No error messages are defined or displayed, and updates are unconditional for matched records.
Tables (Files) Used¶
The program interacts with the following files:
- BBORTR: Input primary file for order transactions (512 bytes, disk).
- Field:
BOCOS
(company/order/sequence, positions 2-12). - BBORDRH: Update-capable file for order header records (512 bytes, indexed, key length 11).
- Fields updated:
LOCK
(position 155, 1 character),WSID
(positions 156-157, 2 characters).
External Programs Called¶
The BB215
RPG program does not call any external programs. All processing is handled internally through file operations and updates.
Summary¶
The BB215
RPG program, called from the BB101.ocl36.txt
OCL program, removes lockout conditions from order header records in the BBORDRH
file by clearing the LOCK
and WSID
fields. It reads order transaction records from BBORTR
, chains to matching BBORDRH
records using the BOCOS
key, and updates the lock-related fields. Business rules ensure lock removal only for matched records, with a one-time initialization to set variables. The program interacts with the BBORTR
and BBORDRH
files and does not call external programs, relying on internal logic for all operations.