BB9541 RPG36
The provided document is an RPG III (or RPG/36) program, BB9541.rpg36.txt
, called from the OCL program BB956P.ocl36.txt
. This program preprocesses data from a customer master file to create a customer list for rack price updates. Below is an explanation of the process steps, business rules, tables used, and any external programs called.
Process Steps of the RPG Program BB9541
¶
The RPG program BB9541
reads records from the PRCTUM
file, processes them based on specific conditions, and writes to the BB954S
file (aliased as ?9?BB956S
in the OCL program). Here’s a step-by-step breakdown of the process:
- File Definitions:
- Input File (
PRCTUM
):- Defined as an input primary file (
IP
) with a record length of 64 bytes, 18-byte key, and accessed via direct access (AI
) on disk. - Fields include:
PCDEL
(position 1): Delete flag ('D' for delete).PCCONO
(positions 2-3): Company number.PCCUST
(positions 4-9): Customer number.PCKEY
(positions 2-9): Composite key (company + customer number).PCPROD
(positions 10-13): Product code.PCCNTR
(positions 14-16): Container code.PCUNMS
(positions 17-19): Unit of measure.
- Defined as an input primary file (
-
Update File (
BB954S
):- Defined as an update file (
UF
) with a record length of 9 bytes, 8-byte key, and accessed via direct access (AI
) on disk. - Fields include:
PSDEL
(position 1): Delete flag ('D' for delete).PSCONO
(positions 2-3): Company number.PSCUST
(positions 4-9): Customer number.
- Defined as an update file (
-
Main Processing Logic:
- The program operates in the RPG fixed logic cycle for a primary file (
PRCTUM
):- Reads each record from
PRCTUM
automatically as part of the cycle. - Processes records with indicator
01
(set when a valid record is read fromPRCTUM
).
- Reads each record from
- Chain Operation:
C 01 PCKEY CHAINBB954S 99
:- For each
PRCTUM
record, the program uses thePCKEY
(company number + customer number) to search for a matching record inBB954S
. - If a matching record is found, indicator
99
is turned off (99 = 0
). If no match is found, indicator99
is turned on (99 = 1
).
-
Exception Output:
C 01 99 EXCPT
:- If no matching record is found in
BB954S
(99 = 1
) and a validPRCTUM
record is read (01 = 1
), the program executes an exception output to write a new record toBB954S
.
-
Output to
BB954S
: -
OBB954S EADD
:- Defines an exception output operation (
EADD
) to add a new record toBB954S
. - The output record contains:
- Position 1: Hard-coded value
'A'
(likely an "active" or "add" flag, as opposed to'D'
for delete). - Positions 2-3:
PCCONO
(company number fromPRCTUM
). - Positions 4-9:
PCCUST
(customer number fromPRCTUM
).
- Defines an exception output operation (
-
Program Termination:
- The RPG cycle continues until all
PRCTUM
records are processed. - The program ends when no more records are available in
PRCTUM
.
Business Rules¶
The business logic of BB9541
is focused on creating a customer list for rack price updates, with the following rules:
1. Input Validation:
- Reads records from the PRCTUM
file, which contains customer data including company number, customer number, product code, container code, and unit of measure.
- Only processes records with a valid PCKEY
(company number + customer number).
- Duplicate Check:
- For each
PRCTUM
record, checks if a record with the samePCKEY
already exists inBB954S
. -
If a record exists (
99 = 0
), no action is taken (the record is skipped to avoid duplicates). -
Record Creation:
- If no matching record is found in
BB954S
(99 = 1
), a new record is created with:- An
'A'
flag to indicate an active or added record. - The company number (
PCCONO
) and customer number (PCCUST
) fromPRCTUM
.
- An
-
The output file
BB954S
is used to store a unique list of company/customer combinations. -
Delete Flag Handling:
-
The
PCDEL
field inPRCTUM
(delete flag) is not explicitly used in the logic, suggesting that records marked for deletion ('D'
) are still processed unless filtered elsewhere (e.g., in the calling OCL or another program). -
Purpose:
- The program creates a deduplicated customer list (
BB954S
) containing only company and customer numbers, likely used downstream in the rack pricing update process (e.g., byBB956P
or other programs in the OCL).
Tables (Files) Used¶
The program interacts with the following files:
1. Input File:
- PRCTUM
: Customer master file containing company number, customer number, product code, container code, unit of measure, and a delete flag.
2. Update/Output File:
- BB954S
(aliased as ?9?BB956S
in the OCL): Output file containing a deduplicated list of company/customer combinations with an active flag ('A'
).
External Programs Called¶
The BB9541
program does not call any external programs. It operates independently, performing file I/O and processing within its own logic.
Summary¶
The BB9541
RPG program preprocesses the PRCTUM
customer master file to create a deduplicated customer list in the BB954S
file (aliased as ?9?BB956S
in the OCL). It reads each PRCTUM
record, checks for duplicates in BB954S
using the PCKEY
(company + customer number), and writes new records with an 'A'
flag if no match is found. The business rules ensure a unique list of company/customer pairs for use in subsequent rack pricing updates. The program uses two files (PRCTUM
and BB954S
) and does not call any external programs.