Skip to content

BB215 RPG36

Process Steps of the RPG Program (BB215.rpg36.txt)

The RPG program BB215 is designed for the IBM System/36 environment and is called by the BB170 OCL procedure during batch deletion operations. Its primary function is to remove lockout conditions from order header records in the BBORDRH file, likely as part of cleaning up a batch being deleted. The program processes records sequentially from the BBORTR file (likely a transaction or temporary order file) and updates corresponding records in BBORDRH to clear lock fields (LOCK and WSID). The program is simple, with minimal logic, and operates within the standard RPG cycle. Below is a step-by-step breakdown of the process:

  1. Initialization (Mainline Calculations):
  2. Check if ONCE (a control variable) is zero, indicating the first pass through the program:
    • If true (ONCE=0), clear LOCK (1 character) and WSID (2 characters) to blanks.
    • Set ONCE to 1 to prevent re-execution of this block in subsequent cycles.
  3. This ensures initialization occurs only once per program run.

  4. Process BBORTR Records (Primary Input):

  5. Read each record from BBORTR (primary file, NS 01, input specification) sequentially.
  6. For each record, extract the BOCOS field (positions 2-12, likely a composite key combining company and order number).
  7. Chain (random read) to the BBORDRH file using BOCOS as the key to locate the corresponding order header record.
  8. If the record is found (indicator 90 off), proceed to output; if not found (90 on), no update occurs for that record.

  9. Update BBORDRH Records (Output):

  10. For each matched record (NS 01 and 90 off), update the BBORDRH record (exception output, D specification):
    • Write LOCK (blanks) to position 155.
    • Write WSID (blanks) to position 157.
  11. This clears the lockout code (LOCK) and workstation ID (WSID) for the order, effectively releasing any lock.

  12. Program Cycle:

  13. The RPG cycle reads all BBORTR records sequentially (IP for primary input file).
  14. For each record, it performs the chain and conditional update.
  15. The program ends when all BBORTR records are processed (end of file, LR set implicitly).

Business Rules

  • Lock Removal:
  • The program removes lockout conditions (LOCK and WSID fields) from order header records in BBORDRH, ensuring orders are no longer marked as locked.
  • This is critical during batch deletion (as invoked by BB170 OCL) to release orders for future processing or cleanup.
  • Key Matching:
  • Uses BOCOS (company + order number, 11 bytes) to match records between BBORTR (transaction/temporary orders) and BBORDRH (order headers).
  • Only matched records (90 off) are updated, ensuring data integrity.
  • Single-Pass Initialization:
  • Clears LOCK and WSID variables once at the start to ensure consistent blank values for updates.
  • No Error Handling:
  • If a BBORDRH record is not found (90 on), the program skips the update without reporting errors, assuming missing records are valid (e.g., already deleted or irrelevant).
  • File Access:
  • BBORTR is read sequentially (input-only, IP).
  • BBORDRH is updated randomly (UC for update-capable, keyed by 11-byte alphanumeric key), ensuring precise record updates.

Tables Used

  • BBORTR:
  • Primary input file, 512-byte records, sequential access (IP).
  • Contains transaction or temporary order records.
  • Key field: BOCOS (positions 2-12, company + order number).
  • BBORDRH:
  • Update-capable file, 512-byte records, 11-byte alphanumeric key, indexed (11AI).
  • Stores order header records.
  • Updated fields: LOCK (position 155, lockout code), WSID (positions 156-157, workstation ID).

External Programs Called

  • None. BB215 is self-contained, with no subroutines or calls to other programs. It relies solely on file I/O and the RPG cycle to process and update records.

The program is a straightforward utility to clear locks, likely used to ensure orders are not left in a locked state during batch deletion, supporting the broader order management workflow.