BB9565 RPG36
The provided document is an RPG III (or RPG/36) program, BB9565.rpg36.txt, called conditionally from the OCL program BB9565.ocl36.txt when the condition at ?L'207,1'? is 'Y' in the main OCL program BB956P.ocl36.txt. This program is part of the rack pricing update process and is responsible for adding new pricing records from the NEWPROD file to the PRCTUM customer master file. Below is an explanation of the process steps, business rules, tables (files) used, and any external programs called.
Process Steps of the RPG Program BB9565¶
The BB9565 program reads records from the NEWPROD file, checks for duplicates in the PRCTUM file, and adds new records to PRCTUM if they do not already exist. Here’s a step-by-step breakdown of the process:
- File and Data Structure Definitions:
- Files:
NEWPROD: Input primary file (IP, 32 bytes, no key specified) containing new product or pricing data.PRCTUM: Update file (UF, 64 bytes, 18-byte key, direct access) containing customer master data, with the ability to add new records (A).
-
Data Structures:
NEWPRODRecord Format:XXCONO(positions 1-2): Company number.XXLOC(positions 3-5): Location code.XXPROD(positions 6-9): Product code.XXCNTR(positions 10-12): Container code.XXUNMS(positions 13-15): Unit of measure.XXKEY2(positions 6-15): Composite key (product + container + unit of measure).PRCTUMRecord Format: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).PCPROD(positions 10-13): Product code.PCCNTR(positions 14-16): Container code.PCUNMS(positions 17-19): Unit of measure.UDS(User Data Structure):KYDATE(positions 105-110): Date input.KYMO(positions 105-106): Month portion of the date.KYYR(positions 109-110): Year portion of the date.KYCO(positions 114-115): Company number.KYJOBQ(position 120): Job queue code.KYCANC(positions 129-134): Cancel flag.KYCUST(positions 201-206): Customer number.Y2KCEN(positions 509-510): Century for Y2K handling (e.g., 19 for 1900s).Y2KCMP(positions 511-512): Comparison year for Y2K logic (e.g., 80).
-
Main Processing Logic:
- The program operates in the RPG fixed logic cycle for the primary file
NEWPROD:- Reads each record from
NEWPRODautomatically when indicator01is on.
- Reads each record from
-
For each
NEWPRODrecord:MOVELXXCONO KEY18 18: Moves the company number (XXCONO) toKEY18.MOVELKYCUST KEY16 16: Moves the customer number (KYCUST) toKEY16.MOVE XXKEY2 KEY16: Appends the composite key (XXKEY2: product + container + unit of measure) toKEY16.MOVE KEY16 KEY18: CombinesKEY16intoKEY18, creating a full key (company + customer + product + container + unit of measure).C KEY18 CHAINPRCTUM 99: Chains toPRCTUMusingKEY18to check if a record with this key exists.C 99 EXCPT: If no matching record is found (99 = 1), executes an exception output to add a new record toPRCTUM.
-
Output to
PRCTUM: -
OPRCTUM EADD:- Adds a new record to
PRCTUMwith: - Position 1: Hard-coded value
'A'(active/add flag, as opposed to'D'for delete). - Positions 2-3:
XXCONO(company number fromNEWPROD). - Positions 4-9:
KYCUST(customer number fromUDS). - Positions 10-13:
XXPROD(product code fromNEWPROD). - Positions 14-16:
XXCNTR(container code fromNEWPROD). - Positions 17-19:
XXUNMS(unit of measure fromNEWPROD).
- Adds a new record to
-
Program Termination:
- The RPG cycle continues until all
NEWPRODrecords are processed. - The program ends when no more records are available in
NEWPROD, marked by theENDtag.
Business Rules¶
The BB9565 program enforces the following business rules:
1. Duplicate Check:
- Checks if a record with the same company number (XXCONO), customer number (KYCUST), product code (XXPROD), container code (XXCNTR), and unit of measure (XXUNMS) already exists in PRCTUM.
- If a matching record exists (99 = 0), the record is skipped to avoid duplicates.
2. Record Addition:
- If no matching record is found (99 = 1), adds a new record to PRCTUM with an active flag ('A') and the relevant data from NEWPROD and KYCUST.
3. Purpose:
- Integrates new pricing data from NEWPROD (generated by earlier programs like BB9563) into the PRCTUM customer master file, ensuring only non-duplicate records are added.
4. No Validation of Other Fields:
- Does not explicitly validate KYDATE, KYCO, or other fields from UDS, suggesting these were validated in prior steps (e.g., BB956P).
Tables (Files) Used¶
The program interacts with the following files:
1. Input File:
- NEWPROD: Contains new product or pricing data with fields:
- XXCONO (positions 1-2): Company number.
- XXLOC (positions 3-5): Location code.
- XXPROD (positions 6-9): Product code.
- XXCNTR (positions 10-12): Container code.
- XXUNMS (positions 13-15): Unit of measure.
- XXKEY2 (positions 6-15): Composite key (product + container + unit of measure).
2. Update/Output File:
- PRCTUM: Customer master file containing:
- PCDEL (position 1): Delete flag.
- PCCONO (positions 2-3): Company number.
- PCCUST (positions 4-9): Customer number.
- PCKEY (positions 2-9): Composite key (company + customer).
- PCPROD (positions 10-13): Product code.
- PCCNTR (positions 14-16): Container code.
- PCUNMS (positions 17-19): Unit of measure.
External Programs Called¶
The BB9565 program does not call any external programs. It performs all processing within its own logic using file I/O operations.
Summary¶
The BB9565 RPG program reads new pricing data from NEWPROD, checks for duplicates in PRCTUM using a composite key (company, customer, product, container, and unit of measure), and adds non-duplicate records to PRCTUM with an active flag ('A'). It ensures that only new, unique pricing records are integrated into the customer master file. The program uses the NEWPROD and PRCTUM files, with no external program calls. It is a critical step in finalizing the rack pricing update process by updating the customer master file with validated pricing data.