Skip to content

BB005 RPG36

The BB005.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 release or post a batch by updating the BBBTCH file based on the program mode (PGM). 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 BB005 RPG program updates the batch status in the BBBTCH file to reflect actions such as releasing, generating a pick list, printing a bill of lading (BOL), or posting the batch. The process is driven by the PGM parameter and involves a single file operation. The steps are as follows:

  1. Program Initialization:
  2. The program is defined with a header specification (H P064) and identified as BB005.
  3. It defines the BBBTCH file as update-capable (48 bytes, indexed, key length 2, access mode 2).
  4. The user data structure (UDS) defines input fields from the local data area:

    • BATCH# (positions 490-491, 2 digits): Batch number.
    • PGM (position 504, 1 character): Program mode ('O', 'L', 'B', or 'P').
    • RECCNT (positions 475-482, 8 digits): Record count.
  5. Main Processing Logic:

  6. The program chains to the BBBTCH file using BATCH# as the key (line 0011).
  7. If a record is found (N99, line 0013), it enters a DO loop (B1 to E1):
    • Checks the PGM value to determine the action:
    • If PGM='O' (Order Entry, lines 0015-0016):
      • Executes the REL exception output to release the batch.
    • If PGM='L' (Pick List, lines 0018-0019):
      • Executes the PICK exception output to generate a pick list.
    • If PGM='B' (Bill of Lading, lines 0021-0022):
      • Executes the BOL exception output to mark the BOL as printed.
    • If PGM='P' (Post, lines 0024-0025):
      • Executes the POST exception output to post the batch.
    • Else (lines 0027-0028):
      • Defaults to executing the REL exception output if PGM is not 'O', 'L', 'B', or 'P'.
    • The nested IF/END structure ensures only one action is performed (lines 0015-0031).
  8. Sets the last record indicator (LR) to exit the program (line 0035).

  9. Output Operations:

  10. The program defines four exception outputs to update the BBBTCH file:
    • REL (Lines 0038-0041):
    • Clears the lock status (position 6) and workstation ID (positions 7-8).
    • Updates the record count (RECCNT) at position 39.
    • PICK (Lines 0043-0047):
    • Clears the lock status (position 6) and workstation ID (positions 7-8).
    • Updates the record count (RECCNT) at position 39.
    • BOL (Lines 0049-0053):
    • Clears the lock status (position 6) and workstation ID (positions 7-8).
    • Sets the BOL printed flag to 'Y' (position 9).
    • Updates the record count (RECCNT) at position 39.
    • POST (Lines 0055-0058):
    • Sets the delete code to 'D' (position 1).
    • Sets the lock status to 'P' (position 6).
    • Updates the record count (RECCNT) at position 39.

Business Rules

The program enforces the following business rules for batch processing:

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

  3. Program Mode Actions:

  4. The PGM parameter determines the action:

    • 'O' (Order Entry): Releases the batch by clearing lock status and workstation ID.
    • 'L' (Pick List): Prepares the batch for picking by clearing lock status and workstation ID.
    • 'B' (Bill of Lading): Marks the batch as having a printed BOL ('Y') and clears lock status and workstation ID.
    • 'P' (Post): Marks the batch as posted by setting the delete code to 'D' and lock status to 'P'.
    • Any other PGM value defaults to releasing the batch (clearing lock status and workstation ID).
  5. Record Count Update:

  6. The record count (RECCNT) is updated in the BBBTCH file for all actions to reflect the current number of records in the batch.

  7. Batch Status Management:

  8. Releasing or generating a pick list clears the lock status and workstation ID, making the batch available for further processing.
  9. Posting a batch marks it as deleted (ABDEL='D') and sets the lock status to 'P' (posted), effectively closing the batch.
  10. The BOL printed flag is set only when PGM='B'.

  11. No Validation or Error Messaging:

  12. The program assumes the calling OCL program (BB101.ocl36.txt) has validated the batch number and program mode.
  13. No error messages are defined or displayed, and processing is unconditional for matched records.

Tables (Files) Used

The program interacts with the following file:

  1. BBBTCH: Update-capable batch header file (48 bytes, indexed, key length 2).
  2. Fields updated:
    • Position 1: Delete code (ABDEL, set to 'D' for POST).
    • Position 6: Lock status (ABLOCK, cleared or set to 'P' for POST).
    • Positions 7-8: Workstation ID (ABLKWS, cleared).
    • Position 9: BOL printed flag (ABPRTD, set to 'Y' for BOL).
    • Positions 32-39: Record count (ABREC, updated with RECCNT).

External Programs Called

The BB005 RPG program does not call any external programs. All processing is handled internally through file updates and exception outputs.


Summary

The BB005 RPG program, called from the BB101.ocl36.txt OCL program, updates the BBBTCH file to release, prepare for picking, mark as BOL printed, or post a batch based on the PGM parameter ('O', 'L', 'B', or 'P'). It chains to the batch record using BATCH#, updates fields like lock status, workstation ID, BOL printed flag, delete code, and record count, and exits. Business rules ensure appropriate status updates based on the program mode, with no additional validations or error messaging. The program interacts solely with the BBBTCH file and does not call external programs, relying on internal logic for all operations.