AR294 RPG36
The AR294.rpg36.txt
is an RPG (Report Program Generator) program for IBM System/36, invoked by the AR290.ocl36.txt
OCL program to retrieve the next invoice transaction file name from a catalog file (AR29WS
) and mark it as processed. Below is a detailed explanation of the process steps, business rules, tables/files used, and any external programs called.
Process Steps of the AR294 RPG Program¶
The AR294
RPG program is a simple utility that processes the catalog file AR29WS
to extract the name of the next invoice transaction file and updates the catalog to indicate it has been processed. Here’s a step-by-step breakdown:
- Read Catalog File (Lines 0006–0015):
- Process:
- Reads the next record from the
AR29WS
file where the record is not marked as processed (NCY
, i.e., theCY
field at position 22 is not 'Y'). - Additional conditions ensure the record is valid:
- Positions 3–4 must match the value in
CB
(likely a control field). - Positions 5–6 must match the value in
CT
andCR
(likely type and record indicators). - Extracts the file label (
LABEL
, positions 1–8) from the record.
- Reads the next record from the
-
Purpose: Identifies the next unprocessed invoice transaction file name from the catalog.
-
Store File Label in LDA (Lines 0011–0012):
- Process:
- Moves the extracted
LABEL
(positions 1–8) to the Local Data Area (LDA,UDS
, positions 1–8).
- Moves the extracted
-
Purpose: Makes the file label available to the calling OCL program for use in subsequent steps (e.g., to open the invoice transaction file in
AR295
). -
Mark Record as Processed (Lines 0015–0019):
- Process:
- Updates the current
AR29WS
record (EXCPT
operation with01
condition) by setting position 22 to'Y'
, indicating the file has been processed. - Sets the Last Record (
LR
) indicator to terminate the program after processing one record.
- Updates the current
- Purpose: Ensures the same file is not processed again in subsequent iterations of the OCL loop.
Business Rules¶
- Selection Criteria:
- Only unprocessed records (
CY
≠ 'Y' at position 22) inAR29WS
are read. -
Records must satisfy additional conditions based on control fields (
CB
,CT
,CR
) to be considered valid, ensuring only relevant invoice transaction file names are selected. -
Single Record Processing:
- The program processes one record per execution, retrieving the next unprocessed file name and marking it as processed.
-
The
LR
indicator ensures the program terminates after processing a single record. -
Data Integrity:
- The
AR29WS
file is opened in update mode (UP
) to allow reading and updating the processed flag. -
The file label is stored in the LDA for use by the OCL program, ensuring accurate communication between programs.
-
No Duplicates:
- The program assumes the catalog file does not allow duplicate keys, ensuring unique file names are processed.
Tables/Files Used¶
The program interacts with the following file:
1. AR29WS (Update, 132 bytes, No Key):
- Catalog file containing invoice transaction file names.
- Key fields:
- LABEL
(positions 1–8): The file name of the invoice transaction file.
- Position 22 (CY
): Flag indicating whether the file has been processed ('Y' for processed, blank or other for unprocessed).
- Positions 3–4 (CB
), 5–6 (CT
, CR
): Control fields for validating records.
External Programs Called¶
- None: The
AR294
RPG program does not call any external programs. It is a standalone utility invoked by theAR290.ocl36.txt
OCL program to retrieve and mark invoice transaction file names.
Additional Notes¶
- Role in OCL:
AR294
is called within the OCL program’s loop (LOOP
tag) to fetch the next invoice transaction file name for processing byAR295
.- The OCL program uses the
LABEL
stored in the LDA to dynamically open the corresponding invoice transaction file (BBTRAN
). - Simplicity:
- The program is lightweight, designed to perform a single task: retrieve one file name and mark it as processed.
- It relies on the OCL program to manage the loop and invoke subsequent processing (
AR295
). - Legacy Context:
- This RPG III program is designed for the IBM System/36, using fixed-format code with cycle-based processing.
- The use of
EXCPT
for output and the LDA for inter-program communication is typical for System/36 RPG programs. - Data Area (LDA):
- The Local Data Area (
UDS
) is used to pass the file label back to the OCL program, a common mechanism for data exchange in System/36.
This program supports the accounts receivable system by providing the next invoice transaction file name for salesman code updates, ensuring each file is processed exactly once in a controlled manner.