BB953 RPG36
The provided document, BB953.rpg36.txt
, is an RPG (Report Program Generator) program for the IBM System/36 environment (or AS/400 in compatibility mode), named BB953
. It is invoked by the OCL script BB953B.ocl36.txt
as the final step in the rack pricing process within the PRICES.ocl36.txt
workflow, which is itself part of the PRICEGEN.clp
pricing generation process for blended lubes. The program generates a rack price report by processing the sorted temporary file BB9531
(from BB9534
and #GSORT
), printing the last two price changes for each product/container/unit of measure combination within two print lines for easy customer quoting. Below, I will explain the process steps, business rules, tables used, and external programs called, noting that the document is truncated but sufficient to infer key functionality.
Process Steps of the RPG Program¶
- File Definitions:
- Input Files:
BB9531
(Input Primary,IP
, 169 bytes, disk): Sorted temporary file, mapped to?9?BB953S
(e.g.,ABB953S
), containing filtered pricing data fromBB9534
.BICONT
(Input,IC
, 256 bytes, indexed with 2-byte key, disk): Contract file for company data, shared read with record locking.GSTABL
(Input,IC
, 256 bytes, indexed with 12-byte key, disk): Table file for product class and division data, shared read with record locking.INLOC
(Input,IC
, 512 bytes, indexed with 5-byte key, disk): Location file for location descriptions, shared read with record locking.GSCNTR1
(Input,IF
, 512 bytes, indexed with 3-byte key, disk): Container file for container descriptions, shared read (replacesGSTABL
for container codes per JK01).
-
Output Files:
OUTFILE
(Output,O
, 121 bytes, disk): Rack price output file, mapped to?9?RKPRCE
(e.g.,ARKPRCE
), shared mode.LIST
(Output,O
, 164 bytes, printer): Printer file for the rack price report.
-
Extension Specifications:
-
Arrays for processing and reporting:
XXPR
(5 elements, 9 bytes, 4 decimals): Current rack prices.XXQT
(5 elements, 7 bytes, 0 decimals): Quantity levels.PRPR
(5 elements, 9 bytes, 4 decimals): Previous rack prices.SEP
(82 elements, 2 bytes): Separator line (--
) for formatting between locations.QTY
(5 elements, 10 bytes): Quantity headings (e.g., quantity ranges).QTH
(10 elements, 1 byte): Quantity heading flags.QT
(5 elements, 1 byte): Quantity type (begin or end).BQT
(5 elements, 1 byte): Beginning quantity flags.EQT
(5 elements, 1 byte): Ending quantity flags.DESC
(4 elements, 10 bytes): Freight descriptions (e.g., COLLECT, PPD & ADD, DELIVERED, 3RD PARTY).COM
(2 elements, 15 bytes): Division descriptions (e.g., REFINERY, BLENDED LUBES).ERR
(3 elements, 30 bytes): Error messages (e.g., NO PRODUCT CLASS LISTED, BAD PRODUCT, NO SHIPTO RECORD EXISTS).
-
Input Specifications:
- BB9531 (record type
NS
):XXCO
(1–2): Company number.XXLOC
(3–5): Location.ILKEY
(1–5): Key field (company + location).XXPRGRL1
(6–7): Product group.XXPROD
(8–11): Product code.XXCNTR
(12–14): Container code.XXUNMS
(15–17): Unit of measure.XXQT
(18–52): Quantity levels (5 elements).XXPR
(53–82): Current prices (5 elements, packed).PRPR
(83–112): Previous prices (5 elements, packed).XXDES1
(113–132): Product description.ABDSCP
(133–142): Short description.XXDATE
(143–150): Date (CYMD).XXTIME
(151–154): Time (HHMM).XXMINQ
(155–161): Minimum quantity.XXDIV
(162–164): Division code.XXPRCL
(165–167): Product class code.XXRKRQ
(168): No rack price required flag (per JB04).XXINAC
(169): Inactive flag (b
,I
, orB
, per JB04).
- BICONT (record type
NS
):BCDEL
(1): Delete code.BCCO
(2–3): Company number.BCNAME
(4–33): Company name.
- GSTABL (record type
NS
):TBDEL
(1): Delete code.TBCSRT
(178–179): Division code.
- INLOC (record type
NS
):ILDEL
(1): Delete code.ILLOC
(2–4): Location code.ILDESC
(5–34): Location description.
-
GSCNTR1 (record type
NS
):TCDEL
(1): Delete code.TCCNTR
(2–4): Container code.TCDESC
(14–43): Container description (per JK01).
-
Calculation Specifications (inferred due to truncation):
- Main Loop:
- Processes each
BB9531
record (01 DO
, implied).
- Processes each
- Filtering:
- Skips deleted records (
XXDEL = 'D'
fromBICONT
,GSTABL
,INLOC
,GSCNTR1
). - Applies date range filtering using
KYFRDT
andKYTODT
(from UDS, set byBB953B.ocl36.txt
).
- Skips deleted records (
- Lookups:
- Chains
BICONT
usingXXCO
to get company name (BCNAME
). - Chains
INLOC
usingILKEY
(company + location) to get location description (ILDESC
). - Chains
GSTABL
for division description (TBCSRT
). - Chains
GSCNTR1
usingXXCNTR
to get container description (TCDESC
, per JK01).
- Chains
- Price Processing:
- Compares
XXDATE
andXXTIME
to identify the last two price changes for each product/container/unit of measure combination. - Stores current prices (
XXPR
) and previous prices (PRPR
) for reporting.
- Compares
- Formatting:
- Uses
QTY
,BQT
,EQT
to format quantity headings (e.g., begin/end ranges). - Sets flags for inactive records (
XXINAC
, e.g.,'I'
or'B'
) and rack price not required (XXRKRQ
, per JB04).
- Uses
-
Output:
- Writes to
OUTFILE
(?9?RKPRCE
) with pricing data (121 bytes). - Writes to
LIST
(printer) with formatted report lines.
- Writes to
-
Output Specifications:
- LIST (printer, 164 bytes):
- Header (
D 0
,OF
): - Company name (
BCNAME
), division (DIVNAM
), date (SYSDAT
), time (SYSTIM
), page (PAGE1
). - Fields: Location (
XXLOC
), product class (XXPRCL
), product (XXPROD
), container (XXCNTR
), unit of measure (XXUNMS
), quantities (XXQT,1
–XXQT,4
), prices (XXPR,1
–XXPR,4
), minimum quantity (XXMINQ
). - Detail Lines:
PRTLN1
(EF 1
): Prints product, description (XXDES1
), container code (XXCNTR
), container description (CNTDSC
), unit of measure (XXUNMS
), effective date (CURDAT
, MM/DD/YY), time (CURTIM
), quantities (QTY,1
–QTY,4
), prices (XXPR,1
–XXPR,4
), minimum quantity (XXMINQ4
), and flags (XXINAC
,XXRKRQ
).PRTLN2
(EF02
,EF10
): Prints product class description (PRCLDS
) and code (XXPRCL
).PRTSEP
(EF 1
): Prints separator line (SEP
) between locations.- Flags (per JB04):
'INACTIVE'
ifXXINAC = 'I'
(indicator 22).'INACTIV BUT'
ifXXINAC = 'B'
(indicator 23).'RACK NOT REQ''D'
ifXXRKRQ
is set (indicator 21).
- Header (
- OUTFILE (
?9?RKPRCE
, 121 bytes):- Writes pricing data, likely including company, location, product, container, prices, quantities, and flags.
Business Rules¶
- Purpose: Generates a rack price report showing the last two price changes for each product/container/unit of measure combination, formatted within two print lines for easy customer quoting, and writes pricing data to
OUTFILE
(?9?RKPRCE
). - Price Reporting:
- Selects the most recent and second-most recent price changes based on
XXDATE
andXXTIME
. - Prints current prices (
XXPR
) and previous prices (PRPR
) for up to four quantity levels (XXQT,1
–XXQT,4
). - Filtering:
- Excludes deleted records (
BCDEL
,TBDEL
,ILDEL
,TCDEL = 'D'
). - Filters by date range (
KYFRDT
toKYTODT
, set byBB953B.ocl36.txt
). - Applies division, location, product class, container, and product filters from UDS (set in
BB953B
). - Formatting:
- Groups output by company, location, product class, product, container, and unit of measure.
- Uses separator lines (
SEP
) between locations for readability. - Includes quantity headings (
QTY
) and flags for inactive records (XXINAC
) and rack price exemptions (XXRKRQ
). - Descriptions:
- Retrieves company name (
BCNAME
) fromBICONT
. - Retrieves location description (
ILDESC
) fromINLOC
. - Retrieves division (
TBCSRT
) fromGSTABL
. - Retrieves container description (
TCDESC
) fromGSCNTR1
(per JK01). - Context: Final step in the
BB953B.ocl36.txt
workflow, producing the rack price report (LIST
) and data file (?9?RKPRCE
) from?9?BB953S
.
Tables (Files) Used¶
- BB9531 (
?9?BB953S
): - Access: Input Primary (
IP
), shared mode. - Purpose: Sorted pricing data from
BB9534
via#GSORT
. - BICONT (
?9?BICONT
): - Access: Input (
IC
), shared read with record locking. - Purpose: Provides company name (
BCNAME
). - GSTABL (
?9?GSTABL
): - Access: Input (
IC
), shared read with record locking. - Purpose: Provides division code (
TBCSRT
). - INLOC (
?9?INLOC
): - Access: Input (
IC
), shared read with record locking. - Purpose: Provides location description (
ILDESC
). - GSCNTR1 (
?9?GSCNTR1
): - Access: Input (
IF
), shared read. - Purpose: Provides container description (
TCDESC
). - OUTFILE (
?9?RKPRCE
): - Access: Output (
O
), shared mode. - Purpose: Stores final rack pricing data.
- LIST:
- Access: Output (
O
), printer. - Purpose: Generates the formatted rack price report.
External Programs Called¶
- None: The
BB953
RPG program does not call external programs or subroutines. It performs internal processing and output formatting.
Additional Notes¶
- Context with BB953B.ocl36.txt: Final program in the
BB953B
workflow, processing?9?BB953S
to produce?9?RKPRCE
and the printed report (LIST
). - Revisions:
- FHL082198: Fixed index error in
BQT
(quantity handling). - FHL112098: Printed container code before description.
- LT03 (09/14/11): Removed tax arrays.
- JB04 (09/20/12): Added
XXRKRQ
andXXINAC
fields. - JK01 (02/24/16): Replaced
GSTABL
withGSCNTR1
for container data. - System/36 Environment: Uses RPG II/III syntax, likely on AS/400.
- Truncation: The document is truncated, but output specifications provide sufficient detail. Missing calculations likely involve price comparison and formatting logic.
- Error Handling: Uses
ERR
array for messages (e.g., NO PRODUCT CLASS LISTED) and relies on System/36 for file errors.
If you have the RPG source code for the SA505*
programs or need further analysis of the pricing workflow, please provide those details! Let me know if you have additional questions or files to share.