BB9534 RPG
The provided document, BB9534.rpg.txt, is an RPG (Report Program Generator) program for the IBM System/36 environment (or AS/400 in compatibility mode), named BB9534. It is invoked by the OCL script BB953B.ocl36.txt as part of the rack pricing process within the PRICES.ocl36.txt workflow, which is itself called by PRICEGEN.clp. The program filters records from the temporary file BB9531 (produced by BB9531) based on selection criteria (division, location, product class, container, and product code) and writes valid records to another temporary file, BB9532, for further processing in the rack price reporting sequence. Below, I will explain the process steps, business rules, tables used, and external programs called .
Process Steps of the RPG Program¶
- File Definitions:
- Input File:
BB9531(Input Primary,IP, 169 bytes, disk): Temporary file, mapped to?9?BB9531(e.g.,ABB9531), containing preprocessed pricing data fromBB9531.
- Output File:
BB9532(Output,O, 169 bytes, disk): Temporary file, mapped to?9?BB9532(e.g.,ABB9532), for filtered pricing data.
-
Note: The file definitions were updated in revision JB01 (09/19/12) to reflect a record length increase from 167 to 169 bytes to accommodate new fields (
RKRKRQandRKINAC). -
Extension Specifications:
-
Arrays for filtering:
LOC(5 elements, 3 bytes): Stores location codes (KYLOC1toKYLOC5).CLS(10 elements, 3 bytes): Stores product class codes (KYPC01toKYPC10).CTR(5 elements, 3 bytes): Stores container codes (KYCT01toKYCT05).PROD(10 elements, 4 bytes): Stores product codes (KYPD01toKYPD10).
-
Input Specifications:
- BB9531 (record type
NS 01):RKCONO(1–2): Company number.RKLOC(3–5): Location.RKPROD(8–11): Product code.RKCNTR(12–14): Container code.RKDIV(163–164): Division code.RKPRCL(165–167): Product class code.RKRKRQ(168): No rack price required flag (added per JB01).RKINAC(169): Inactive flag (b,I, orB, added per JB01).RECORD(1–169): Entire 169-byte record.
-
User Data Structure (UDS):
KYDIV(103): Division filter ('ALL' or 'CO').KYLOSL(104–106): Location selection ('SEL' for specific locations).KYLOC1–KYLOC5(107–121): Location codes (3 bytes each).LOC(107–121): Array of location codes.KYPCSL(122–124): Product class selection ('SEL' for specific classes).KYPC01–KYPC10(125–154): Product class codes (3 bytes each).CLS(125–154): Array of product class codes.KYCTSL(155–157): Container selection ('SEL' for specific containers).KYCT01–KYCT05(158–172): Container codes (3 bytes each).CTR(158–172): Array of container codes.KYPDSL(173–175): Product code selection ('SEL' for specific products).KYPD01–KYPD10(176–215): Product codes (4 bytes each).PROD(176–215): Array of product codes.KYDTSL(216–218): Date selection ('SEL' for date range).KYFRDT(219–224): From date (YYMMDD).KYTODT(225–230): To date (YYMMDD).KYJOBQ(231): Job queue indicator.KYCOPY(232–233): Copy number.KYDVNO(234–235): Division number.KYDAT8(236–243): Key date (CYMD, set byBB953B).
-
Calculation Specifications:
- Main Loop:
- Processes each
BB9531record (01 DO, implied).
- Processes each
- Indicator Setup:
SETOF 5051: Clears indicators50and51.SETON 52: Sets indicator52(assume record is valid unless filtered out).
- Division Filter:
- If
KYDIV ≠ 'ALL', checks ifRKDIVmatches the specified division (logic not shown due to truncation, likely sets51if no match).
- If
- Location Filter (
LOCSRsubroutine):- If
KYLOSL = 'SEL': - Loops through
LOCarray (5 elements). - If
RKLOCmatches anyKYLOC1–KYLOC5, sets50; otherwise, sets51(invalid record). - If
KYLOSL ≠ 'SEL', skips location check.
- If
- Product Class Filter (
PRCLSRsubroutine):- If
KYPCSL = 'SEL': - Loops through
CLSarray (10 elements). - If
RKPRCLmatches anyKYPC01–KYPC10, sets50; otherwise, sets51. - If
KYPCSL ≠ 'SEL', skips product class check.
- If
- Container Filter (
CNTRSRsubroutine):- If
KYCTSL = 'SEL': - Loops through
CTRarray (5 elements). - If
RKCNTRmatches anyKYCT01–KYCT05, sets50; otherwise, sets51. - If
KYCTSL ≠ 'SEL', skips container check.
- If
- Product Code Filter (
PRODSRsubroutine):- If
KYPDSL = 'SEL': - Loops through
PRODarray (10 elements). - If
RKPRODmatches anyKYPD01–KYPD10, sets50; otherwise, sets51. - If
KYPDSL ≠ 'SEL', skips product code check.
- If
- Output Decision:
- If
50(valid record) or52(no filtering applied), executesEXCPTGOODto write the entireRECORD(169 bytes) toBB9532. - If
51(invalid record), skips toENDtag, omitting the record.
- If
-
Subroutines:
LOCSR,PRCLSR,CNTRSR,PRODSR: Validate location, product class, container, and product code, respectively, setting indicators to control output.
-
Output Specifications:
BB9532(EADD,GOOD):RECORD(1–169): Writes the entire 169-byte input record, including company, location, product, container, division, product class, and flags (RKRKRQ,RKINAC).
Business Rules¶
- Purpose: Filters pricing records from
BB9531based on division, location, product class, container, and product code criteria, writing valid records toBB9532for sorting and reporting in the rack pricing process. - Filtering Logic:
- Division: If
KYDIV ≠ 'ALL', includes records matching the specified division (RKDIV). - Location: If
KYLOSL = 'SEL', includes records whereRKLOCmatches one ofKYLOC1–KYLOC5. - Product Class: If
KYPCSL = 'SEL', includes records whereRKPRCLmatches one ofKYPC01–KYPC10. - Container: If
KYCTSL = 'SEL', includes records whereRKCNTRmatches one ofKYCT01–KYCT05. - Product Code: If
KYPDSL = 'SEL', includes records whereRKPRODmatches one ofKYPD01–KYPD10. - A record is written to
BB9532only if all applied filters pass (50on) or no filters are applied (52on). - Data Preservation: Valid records are copied unchanged (169 bytes, including
RKRKRQandRKINACflags added per JB01). - Context: Follows
BB9531in theBB953B.ocl36.txtworkflow, producing?9?BB9532for sorting by#GSORTand final reporting byBB953. - Default Behavior: If no selection criteria are specified (
KYDIV = 'ALL',KYLOSL,KYPCSL,KYCTSL,KYPDSL ≠ 'SEL'), all records are written (52on).
Tables (Files) Used¶
- BB9531 (
?9?BB9531): - Access: Input Primary (
IP), shared mode (DISP-SHRfrom OCL). - Purpose: Source of preprocessed pricing data from
BB9531. - BB9532 (
?9?BB9532): - Access: Output (
O), shared mode (DISP-SHR). - Purpose: Destination for filtered pricing records.
External Programs Called¶
- None: The
BB9534RPG program does not call external programs or subroutines. It performs internal filtering using subroutines (LOCSR,PRCLSR,CNTRSR,PRODSR).
Additional Notes¶
- Context with BB953B.ocl36.txt: Invoked after
BB9531, processing?9?BB9531to produce?9?BB9532, which is sorted by#GSORTinto?9?BB953SforBB953. - Revisions:
- JB01 (09/19/12): Increased record length to 169 bytes, added
RKRKRQandRKINACfields. - System/36 Environment: Uses RPG II/III syntax, likely on AS/400.
- Truncation: The document is truncated, but the provided code includes all critical sections (
F,E,I,C,O), sufficient to understand the filtering logic. - Error Handling: Relies on indicators (
50,51,52) and System/36 environment for error handling. - Similarity to BI9444: The program’s structure mirrors
BI9444.rpg.txt, indicating a common pattern for filtering temporary files in the pricing workflow.
If you have the RPG source code for BB953, SA505C, or other SA505* programs, or need further analysis, please provide those details! Let me know if you have additional questions or files to share.