BB9566 RPG36
The provided document is an RPG III (or RPG/36) program, BB9566.rpg36.txt
, called unconditionally from the OCL program BB9566.ocl36.txt
as the final step in the rack pricing update process orchestrated by the main OCL program BB956P.ocl36.txt
. This program processes rack pricing data from the RKPRCE
file, validates it against the PRCTUM
customer master file, and writes matching records to the RKPRCEO
file (aliased as ?9?PRCDOWN
) for download or further use. Below is an explanation of the process steps, business rules, tables (files) used, and any external programs called.
Process Steps of the RPG Program BB9566
¶
The BB9566
program reads records from the RKPRCE
file, checks for corresponding records in the PRCTUM
file, and writes valid records to the RKPRCEO
file. Here’s a step-by-step breakdown of the process:
- File and Data Structure Definitions:
- Files:
RKPRCE
: Input primary file (IP
, 121 bytes, no key specified) containing rack pricing data.PRCTUM
: Input file (IF
, 64 bytes, 18-byte key, direct access) containing customer master data.RKPRCEO
: Output file (O
, 121 bytes, no key, allows additions withA
) for storing pricing data for download.
-
Data Structures:
RKPRCE
Record Format:XXCONO
(positions 1-2): Company number.XXLOC
(positions 3-5): Location code.XXPRCL
(positions 6-8): Price class.XXPROD
(positions 9-12): Product code.XXDES1
(positions 13-32): Product description.XXCNTR
(positions 33-35): Container code.XXUNMS
(positions 36-38): Unit of measure.XXDATE
(positions 39-46): Date.XXTIME
(positions 47-52): Time.XXREC
(positions 1-121): Entire record (for copying to output).PRCTUM
Record Format:PCDEL
(position 1): Delete flag ('D' for delete).PCCONO
(positions 2-3): Company number.PCCUST
(positions 4-9): Customer number.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.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
RKPRCE
:- Reads each record from
RKPRCE
automatically when indicator01
is on.
- Reads each record from
-
For each
RKPRCE
record:MOVELXXCONO KEY18 18
: Moves the company number (XXCONO
) toKEY18
.MOVELKYCUST KEY10 10
: Moves the customer number (KYCUST
) toKEY10
.MOVE XXPROD KEY10
: Appends the product code (XXPROD
) toKEY10
.MOVELXXCNTR KEY6 6
: Moves the container code (XXCNTR
) toKEY6
.MOVE XXUNMS KEY6 6
: Appends the unit of measure (XXUNMS
) toKEY6
.MOVELKEY10 KEY16 16
: MovesKEY10
(customer + product) toKEY16
.MOVE KEY6 KEY16
: AppendsKEY6
(container + unit of measure) toKEY16
.MOVE KEY16 KEY18
: CombinesKEY16
intoKEY18
, creating a full key (company + customer + product + container + unit of measure).C KEY18 CHAINPRCTUM 99
: Chains toPRCTUM
usingKEY18
to check if a matching record exists.C N99 EXCPT
: If a matching record is found (99 = 0
), executes an exception output to write toRKPRCEO
.
-
Output to
RKPRCEO
: -
ORKPRCEO EADD
:- Adds a new record to
RKPRCEO
with: XXREC
(positions 1-121): The entireRKPRCE
record, copied as-is.
- Adds a new record to
-
Program Termination:
- The RPG cycle continues until all
RKPRCE
records are processed. - The program ends when no more records are available in
RKPRCE
, marked by theEND
tag.
Business Rules¶
The BB9566
program enforces the following business rules:
1. Record Matching:
- Only writes RKPRCE
records to RKPRCEO
if a matching record exists in PRCTUM
based on the composite key (company number, customer number, product code, container code, and unit of measure).
- If no match is found in PRCTUM
(99 = 1
), the RKPRCE
record is skipped.
2. Output Generation:
- Copies the entire RKPRCE
record (XXREC
) to RKPRCEO
without modification for matching records, preserving all fields (company, location, price class, product, description, container, unit of measure, date, time).
3. Purpose:
- Generates a pricing download file (RKPRCEO
/?9?PRCDOWN
) containing validated rack pricing records that align with customer data in PRCTUM
, likely for use in external systems or reporting.
4. No Date Validation:
- Does not explicitly validate KYDATE
or other fields from UDS
, suggesting that date validation occurred in prior steps (e.g., BB9563
or BB956P
).
Tables (Files) Used¶
The program interacts with the following files:
1. Input Files:
- RKPRCE
: Rack pricing file containing:
- XXCONO
(positions 1-2): Company number.
- XXLOC
(positions 3-5): Location code.
- XXPRCL
(positions 6-8): Price class.
- XXPROD
(positions 9-12): Product code.
- XXDES1
(positions 13-32): Product description.
- XXCNTR
(positions 33-35): Container code.
- XXUNMS
(positions 36-38): Unit of measure.
- XXDATE
(positions 39-46): Date.
- XXTIME
(positions 47-52): Time.
- XXREC
(positions 1-121): Entire record.
- PRCTUM
: Customer master file containing:
- PCDEL
(position 1): Delete flag.
- PCCONO
(positions 2-3): Company number.
- PCCUST
(positions 4-9): Customer number.
- PCPROD
(positions 10-13): Product code.
- PCCNTR
(positions 14-16): Container code.
- PCUNMS
(positions 17-19): Unit of measure.
2. Output File:
- RKPRCEO
(aliased as ?9?PRCDOWN
): Pricing download file, containing the entire RKPRCE
record for matching records.
External Programs Called¶
The BB9566
program does not call any external programs. It performs all processing within its own logic using file I/O operations.
Summary¶
The BB9566
RPG program processes rack pricing data from RKPRCE
, validates each record against the PRCTUM
customer master file using a composite key (company, customer, product, container, and unit of measure), and writes matching records to the RKPRCEO
(?9?PRCDOWN
) file for download. The program copies the entire RKPRCE
record without modification for valid matches. It uses the RKPRCE
, PRCTUM
, and RKPRCEO
files, with no external program calls. This program finalizes the rack pricing update process by generating a download file containing validated pricing data.