Skip to content

BB005 RPG36

The BB005.rpg36.txt is an RPG II program running on an IBM System/36, designed to release or post batches in the order entry process. It is called by the BB110P.ocl36 program during the batch release phase. The program updates the BBBTCH file based on the program mode (PGM) and batch number (BATCH#). Below, I’ll explain the process steps, business rules, tables (files) used, and any external programs called.


Process Steps of the BB005 RPG Program

The program performs a single, focused task: updating the batch status in the BBBTCH file based on the mode specified in the PGM field. Here’s a step-by-step breakdown of the process:

  1. Retrieve Batch Record:
  2. Line 0011: Uses the batch number (BATCH#, from LDA offset 490–491) to chain to the BBBTCH file. If the batch is not found, indicator 99 is set, and the program skips further processing.

  3. Process Batch Based on Program Mode:

  4. Line 0013: If the batch is found (N99), enters a DO loop to process the batch update.
  5. Lines 0015–0031: Checks the PGM field (from LDA offset 504) to determine the update type:

    • If PGM = 'O' (Order Entry):
    • Executes the REL output operation to release the batch.
    • If PGM = 'L' (Pick List):
    • Executes the PICK output operation to update the batch for pick list processing.
    • If PGM = 'B' (Bill of Lading):
    • Executes the BOL output operation to mark the batch as printed for the Bill of Lading.
    • If PGM = 'P' (Posting):
    • Executes the POST output operation to post the batch.
    • Default (if PGM is none of the above):
    • Executes the REL output operation as a fallback.
  6. Update Batch File:

  7. Lines 0038–0058: Defines output operations for BBBTCH:

    • REL (Lines 0038–0041):
    • Clears lock status (ABLOCK, position 6) to ' '.
    • Clears lock workstation ID (ABLKWS, position 8) to ' '.
    • Updates record count (ABREC, position 32–39) with RECCNT (from LDA offset 475–482).
    • PICK (Lines 0043–0047):
    • Clears lock status (ABLOCK, position 6) to ' '.
    • Clears lock workstation ID (ABLKWS, position 8) to ' '.
    • Updates record count (ABREC, position 32–39) with RECCNT.
    • BOL (Lines 0049–0053):
    • Clears lock status (ABLOCK, position 6) to ' '.
    • Clears lock workstation ID (ABLKWS, position 8) to ' '.
    • Sets BOL printed flag (ABPRTD, position 9) to 'Y'.
    • Updates record count (ABREC, position 32–39) with RECCNT.
    • POST (Lines 0055–0058):
    • Sets delete code (ABDEL, position 1) to 'D'.
    • Sets lock status (ABLOCK, position 6) to 'P' (posted).
    • Updates record count (ABREC, position 32–39) with RECCNT.
  8. Program Termination:

  9. Line 0035: Sets the Last Record (LR) indicator to terminate the program after processing.

Business Rules

  1. Batch Existence:
  2. The batch number (BATCH#) must exist in the BBBTCH file. If not found, no updates are performed, and the program exits.

  3. Program Mode Handling:

  4. The PGM field determines the batch update type:

    • 'O': Releases the batch, clearing lock fields.
    • 'L': Updates the batch for pick list processing, clearing lock fields.
    • 'B': Marks the batch as printed for the Bill of Lading, setting ABPRTD = 'Y'.
    • 'P': Posts the batch, marking it as deleted (ABDEL = 'D') and setting ABLOCK = 'P'.
    • Any other value defaults to releasing the batch (REL).
  5. Record Count Update:

  6. The record count (RECCNT, from LDA) is updated in the BBBTCH file’s ABREC field for all operations.

  7. Lock Management:

  8. For REL, PICK, and BOL operations, the batch is unlocked by clearing ABLOCK and ABLKWS.
  9. For POST, the batch is marked as posted (ABLOCK = 'P') and deleted (ABDEL = 'D').

  10. Minimal Error Handling:

  11. The program assumes valid input from the calling OCL program and does not perform extensive validation beyond checking if the batch exists.

Tables (Files) Used

  1. BBBTCH:
  2. Type: Indexed disk file (48 bytes, update-capable, shared access).
  3. Purpose: Stores and updates batch control data, including lock status, workstation ID, BOL printed flag, delete code, and record count.
  4. Fields Updated:
    • ABDEL (position 1): Delete code (set to 'D' for POST).
    • ABLOCK (position 6): Lock status (cleared to ' ' for REL, PICK, BOL; set to 'P' for POST).
    • ABLKWS (position 7–8): Lock workstation ID (cleared to ' ' for REL, PICK, BOL).
    • ABPRTD (position 9): BOL printed flag (set to 'Y' for BOL).
    • ABREC (position 32–39): Record count (updated with RECCNT).

External Programs Called

  • None: The BB005 program does not explicitly call any external RPG programs. It performs a single, focused update operation on the BBBTCH file and relies on the calling OCL program (BB110P.ocl36) for context and further processing.

Summary

The BB005 RPG program is a simple utility that updates the BBBTCH file to release, process, or post a batch based on the PGM mode: - Retrieves the batch record using BATCH#. - Updates lock status, BOL printed flag, delete code, and record count based on the mode (O, L, B, or P). - Terminates after updating the batch.

Tables Used: BBBTCH. External Programs Called: None.