Skip to content

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:

  1. Program Initialization:
  2. The program is defined with a header specification (H P064) and identified as BB215.
  3. 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.
  4. Input specifications:
    • For BBORTR (name specification 01, indicators 10, 11, 12): Defines BOCOS (company/order/sequence, positions 2-12).
    • For BBORDRH (name specification 09): No specific fields defined in the provided code, but implied to use BOCOS as the key.
  5. Variables:

    • LOCK (1 character): Lock status field.
    • WSID (2 characters): Workstation ID field.
    • ONCE (1 digit): Control variable to ensure one-time initialization.
  6. Main Processing Logic:

  7. One-Time Initialization (lines 0015-0019):
    • Checks if ONCE is zero (IFEQ *ZERO, indicator B1).
    • If true, clears LOCK and WSID to blanks and sets ONCE to 1.
    • Ensures this initialization occurs only once per program execution.
  8. Record Processing (lines 0022-0027):

    • For each BBORTR record (indicator 01), chains to BBORDRH using BOCOS (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 indicators 01 and N90.
  9. Output Operations:

  10. 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).

Business Rules

The program enforces the following business rules for lockout removal:

  1. Lock Removal:
  2. For each order transaction record in BBORTR, the corresponding order header record in BBORDRH is updated to clear the lock status (LOCK) and workstation ID (WSID).
  3. This effectively removes any lockout conditions, making the order header available for further processing.

  4. Key Matching:

  5. The program uses the BOCOS field (company/order/sequence, positions 2-12) from BBORTR to locate the corresponding BBORDRH record.
  6. Updates occur only if a matching record is found (N90).

  7. One-Time Initialization:

  8. The ONCE variable ensures that the initialization of LOCK and WSID to blanks occurs only once, preventing redundant clearing during program execution.

  9. No Validation or Error Messaging:

  10. The program assumes the calling OCL program (BB101.ocl36.txt) has validated the batch deletion context (e.g., SWITCH1-1).
  11. No error messages are defined or displayed, and updates are unconditional for matched records.

Tables (Files) Used

The program interacts with the following files:

  1. BBORTR: Input primary file for order transactions (512 bytes, disk).
  2. Field: BOCOS (company/order/sequence, positions 2-12).
  3. BBORDRH: Update-capable file for order header records (512 bytes, indexed, key length 11).
  4. 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.