BB9541 RPG36
The provided document, BB9541.rpg36.txt
, is an RPG (Report Program Generator) program for IBM System/3x or AS/400 systems, called by the OCL program BB954P.ocl36.txt
. It serves as a preprocessing step for creating a temporary customer list file (BB954S
) from the customer master file (PRCTUM
) for the rack pricing update process. Below, I’ll explain the process steps, business rules, tables (files) used, and any external programs called.
Process Steps of the RPG Program¶
The RPG program BB9541
is designed to read customer records from the PRCTUM
file, filter them, and write valid records to the BB954S
file. Here’s a detailed breakdown of the process steps:
- File Definitions:
- PRCTUM: Input file (64 bytes, indexed with an 18-byte key, access path
AI
, disk-based). This is the customer master file containing customer and product data. - BB954S: Update file (9 bytes, indexed with an 8-byte key, access path
AI
, disk-based). This is a temporary file used to store the filtered customer list. -
OCL Syntax:
1 2
FPRCTUM IP F 64 64 18AI 2 DISK FBB954S UF F 9 9 8AI 2 DISK A
-
Input Specifications:
- PRCTUM:
PCDEL
(position 1): Delete flag ('D' indicates a deleted record).PCCONO
(positions 2–3): Company number.PCCUST
(positions 4–9): Customer number.PCKEY
(positions 2–9): Composite key (company number + customer number).PCPROD
(positions 10–13): Product code.PCCNTR
(positions 14–16): Container code.PCUNMS
(positions 17–19): Unit of measure.
- BB954S:
PSDEL
(position 1): Delete flag ('A' for active records, as written by this program).PSCONO
(positions 2–3): Company number.PSCUST
(positions 4–9): Customer number.
-
OCL Syntax:
1 2 3 4 5 6 7 8 9 10 11 12
IPRCTUM NS 01 I 1 1 PCDEL I 2 30PCCONO I 4 90PCCUST I 2 90PCKEY I 10 13 PCPROD I 14 16 PCCNTR I 17 19 PCUNMS IBB954S NS I 1 1 PSDEL I 2 30PSCONO I 4 90PSCUST
-
Main Processing Logic:
- The program processes records from
PRCTUM
(indicated byNS 01
, meaning primary file processing in the RPG cycle). - For each record in
PRCTUM
:- Check for Existing Record: Uses the
PCKEY
(company number + customer number) to perform aCHAIN
operation onBB954S
to check if the record already exists. - Write to BB954S: If the record does not exist in
BB954S
(indicator 99 is on, meaning no match found), the program writes a new record toBB954S
using theEXCPT
operation.
- Check for Existing Record: Uses the
- Output to BB954S:
- Sets
PSDEL
to 'A' (indicating an active record). - Copies
PCCONO
(company number) toPSCONO
. - Copies
PCCUST
(customer number) toPSCUST
.
- Sets
-
OCL Syntax:
1 2 3 4 5 6
C 01 PCKEY CHAINBB954S 99 C 01 99 EXCPT OBB954S EADD O 1 'A' O PCCONO 3 O PCCUST 9
-
End of Processing:
- The RPG cycle automatically processes all records in
PRCTUM
until the end of the file. No explicit loop or termination logic is defined, as the RPG cycle handles this inherently.
Business Rules¶
The RPG program BB9541
enforces the following business rules:
- Filter Out Deleted Records:
-
Records in
PRCTUM
marked withPCDEL = 'D'
are not explicitly filtered in the code, but the program assumes valid records (since no condition checksPCDEL
). It’s likely that the OCL program or prior steps ensure only non-deleted records are processed. -
Unique Customer Records:
-
The program checks for existing records in
BB954S
usingPCKEY
(company number + customer number). If a record already exists (indicator 99 off), it skips writing to avoid duplicates. -
Active Record Marking:
-
All records written to
BB954S
are marked withPSDEL = 'A'
, indicating they are active and valid for further processing (e.g., byBB954P
orBB9542
). -
Data Mapping:
- Only the company number (
PCCONO
) and customer number (PCCUST
) are copied fromPRCTUM
toBB954S
. Other fields likePCPROD
,PCCNTR
, andPCUNMS
are defined but not used in this program, suggesting they may be relevant for filtering in other programs or steps.
Tables (Files) Used¶
The RPG program uses the following files: 1. PRCTUM: Customer master file (64 bytes, indexed), containing company and customer data, product codes, container codes, and units of measure. Used as the primary input file. 2. BB954S: Temporary customer list file (9 bytes, indexed), used to store unique company and customer number pairs marked as active ('A'). Used as an update file (input/output).
External Programs Called¶
The RPG program BB9541
does not explicitly call any external programs. It is invoked by the OCL program BB954P.ocl36.txt
as part of the preprocessing step to generate the BB954S
file, which is then used by other programs (BB954P
, BB9542
) in the workflow.
Summary¶
The RPG program BB9541
is a preprocessing step in the rack pricing update process, responsible for creating a temporary customer list (BB954S
) from the customer master file (PRCTUM
). It:
- Reads records from PRCTUM
.
- Checks for duplicate records in BB954S
using the composite key (PCKEY
).
- Writes unique, active records to BB954S
with company and customer numbers.
- Enforces business rules to ensure unique records and marks them as active.
- Uses two files: PRCTUM
(input) and BB954S
(update).
- Does not call external programs but is part of the OCL-driven workflow.
This program sets the stage for subsequent steps, such as validation in BB954P
and pricing updates in BB9542
, by providing a filtered list of valid customers.