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:
- Retrieve Batch Record:
-
Line 0011: Uses the batch number (
BATCH#
, from LDA offset 490–491) to chain to theBBBTCH
file. If the batch is not found, indicator 99 is set, and the program skips further processing. -
Process Batch Based on Program Mode:
- Line 0013: If the batch is found (
N99
), enters aDO
loop to process the batch update. -
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.
- If
-
Update Batch File:
-
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) withRECCNT
(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) withRECCNT
. - 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) withRECCNT
. - 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) withRECCNT
.
-
Program Termination:
- Line 0035: Sets the Last Record (
LR
) indicator to terminate the program after processing.
Business Rules¶
- Batch Existence:
-
The batch number (
BATCH#
) must exist in theBBBTCH
file. If not found, no updates are performed, and the program exits. -
Program Mode Handling:
-
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, settingABPRTD = 'Y'
.'P'
: Posts the batch, marking it as deleted (ABDEL = 'D'
) and settingABLOCK = 'P'
.- Any other value defaults to releasing the batch (
REL
).
-
Record Count Update:
-
The record count (
RECCNT
, from LDA) is updated in theBBBTCH
file’sABREC
field for all operations. -
Lock Management:
- For
REL
,PICK
, andBOL
operations, the batch is unlocked by clearingABLOCK
andABLKWS
. -
For
POST
, the batch is marked as posted (ABLOCK = 'P'
) and deleted (ABDEL = 'D'
). -
Minimal Error Handling:
- 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¶
- BBBTCH:
- Type: Indexed disk file (48 bytes, update-capable, shared access).
- Purpose: Stores and updates batch control data, including lock status, workstation ID, BOL printed flag, delete code, and record count.
- Fields Updated:
ABDEL
(position 1): Delete code (set to'D'
forPOST
).ABLOCK
(position 6): Lock status (cleared to' '
forREL
,PICK
,BOL
; set to'P'
forPOST
).ABLKWS
(position 7–8): Lock workstation ID (cleared to' '
forREL
,PICK
,BOL
).ABPRTD
(position 9): BOL printed flag (set to'Y'
forBOL
).ABREC
(position 32–39): Record count (updated withRECCNT
).
External Programs Called¶
- None: The
BB005
program does not explicitly call any external RPG programs. It performs a single, focused update operation on theBBBTCH
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.