BB951 RPG36
The provided RPG/36 program, BB951.rpg36.txt
, is the final component in the rack price list processing suite, called by the BB951.ocl36.txt
OCL program. Its purpose is to print a rack price report that displays the last two price changes for each product, container, and unit of measure, formatted within two print lines for easy customer quoting. It also incorporates tax information and cost data, and outputs data to a table for salesmen’s pricing reports. Below, I’ll explain the process steps, business rules, tables/files used, and external programs called.
Process Steps of the RPG Program¶
The BB951
RPG program processes data from temporary files (BB9511
, BB9518
), retrieves additional information from reference files (BICONT
, INLOC
, GSTABL
, GSCNTR1
, GLCONT
, ICSUMHY
), and generates a printed report via the LIST
printer file and a data table via BBPRCEC
. Due to the truncation of the code (11,517 characters missing), I’ll base the analysis on the provided portion, focusing on file definitions, input specifications, and output specifications, and infer likely processing steps based on context from the OCL and related programs (BB951P
, BB9511
, BB9518
).
- File and Data Structure Definitions:
- Files:
BB9511
: Primary input file (166 bytes), temporary file containing preprocessed rack price data fromBB9511.rpg36
.BICONT
: Input file (256 bytes, indexed, key length 2 bytes), contains company data.INLOC
: Input file (512 bytes, indexed, key length 5 bytes), contains location data.GSTABL
: Input file (256 bytes, indexed, key length 12 bytes), table file for product group descriptions.BB9518
: Input file (512 bytes, indexed, key length 7 bytes), temporary tax print file fromBB9518.rpg36
.GLCONT
: Input file (256 bytes, indexed, key length 2 bytes), general ledger control file for costing data.ICSUMHY
: Input file (800 bytes, indexed, key length 12 bytes), summary history file for cost data.GSCNTR1
: Input file (512 bytes, indexed, key length 3 bytes), container file (replacedGSTABL
for container codes per JK01).BBPRCEC
: Output file (265 bytes, indexed, key length 27 bytes), table for storing report data for salesmen (per MG01).LIST
: Printer output file (164 bytes), used to print the rack price report.
- Arrays:
XXPR
(5 elements, 9.4): Current rack prices.XXQT
(5 elements, 7.0): Quantity levels.PRPR
(5 elements, 9.4): Previous rack prices.SEP
(82 elements, 2 bytes): Separator lines (e.g.,--
) between locations.QTY
(5 elements, 10 bytes): Quantity headings.QTH
(10 elements, 1 byte): Quantity heading flags.QT
,BQT
,EQT
(5 elements, 1 byte): Quantity flags for beginning/end.TXC
(10 elements, 4 bytes): Tax codes (per LT03).TXD
(10 elements, 30 bytes): Tax descriptions (per LT03).TXR
(10 elements, 5.5): Tax rates (per LT03).
- Input Fields:
BB9511
: Company (XXCO
), location (XXLOC
), product group (XXPRGR
), product (XXPROD
), container (XXCNTR
), unit of measure (XXUNMS
), quantities (XXQT
), prices (XXPR
), previous prices (PRPR
), descriptions (XXDES1
,XXDES2
), date (XXDATE
), time (XXTIME
), minimum quantity (XXMINQ
), rack required (XXRKRQ
), inactive flag (XXINAC
), inventory sort code (XXCSRT
).BICONT
: Company name (BCNAME
).INLOC
: Location name (ILNAME
).GSTABL
: Complete description (TBDES1
).BB9518
: Company (B8CONO
), state (B8STAT
), product group description (B8PGDS
), delivery flag (B8DELV
), tax codes (TXC
), descriptions (TXD
), rates (TXR
).GLCONT
: Last closed month for costing (GCLMCC
, CYM format).ICSUMHY
: Company (GICO
), product (GIPROD
), year (GICYR
), month (GIMO
), cost per gallon product (GICPGP
), cost per gallon close (GICPGC
).
-
Data Structures:
UDS
: ContainsGICYM
(CYM),GICYR
(year),GIMO
(month).- Unnamed DS (lines 0072–0074): Defines
QTYHDR
andQTH
for quantity headings. - Unnamed DS (lines 0077–0078): Defines
ENDQTY
for quantity processing.
-
Output Specifications Overview (lines 0272–0441):
- Printer Output (
LIST
):- PRTHDR (Header Formats):
- Format 02: Prints program ID (
BB951
) and page number (PAGE
). - Format 03: Prints company name (
BCNAME
) and title (RACK PRICE LISTING
). - Format 04: Prints location code (
XXLOC
), name (ILNAME
), and time (SYTIME
). - Format 205: Prints product group (
XXPRGR
), description (GRPDSC
), and date (SYDATEY
). - Format 0: Prints column headers (e.g.,
CNTR
,QUANTITY 1
,PRICE 1
, ...,MIN QTY
). - Format 1: Prints underlines for headers (e.g.,
____
,__________
). - PRTLN1 (Detail Line 1):
- Prints product code (
XXPROD
), description (XXDES1
), container code (XXCNTR
), container description (CNTDSC
), unit of measure (XXUNMS
), effective date (CURDAT
), time (CURTIM
), quantities (QTY,1
toQTY,4
), prices (XXPR,1
toXXPR,4
), minimum quantity (XXMINQ
), and flags (INACTIVE
,INACTIV BUT
,RACK NOT REQ’D
based onXXINAC
andXXRKRQ
). - PRTLN2 (Detail Line 2):
- Prints previous prices (
PRPR,1
toPRPR,4
) with quantities and minimum quantity. - PRTSEP (Separator):
- Prints separator lines (
SEP
) between locations. - PRTTXH (Tax Header):
- Prints
TOTAL TAX
and a separator (|
). - PRTTX (Tax Details):
- Prints state (
B8STAT
), product group description (B8PGDS
), delivery flag (B8DELV
), total tax rate (TOTTXR
), and up to 10 tax codes (TXC
), descriptions (TXD
), and rates (TXR
).
-
Table Output (
BBPRCEC
):- Writes fields like company (
RCCO
), location (RCLOC
), product (RCPROD
), container (RCCNTR
), unit of measure (RCUNMS
), date (RCDATE
), time (RCTIME
), product/container descriptions (RCPRDS
,RCCNDS
), prices (PCPRCE
toPCPR05
), quantities (PCQT01
toPCQT05
), minimum quantity (RCMINQ
), rack required (RCRKRQ
), inactive flag (RCINAC
), and cost per gallon (ICCPGP
).
- Writes fields like company (
-
Inferred Main Processing Loop (based on context and output specifications):
- Read
BB9511
Records:- Processes records by company (
XXCO
, levelL3
) and location (XXLOC
, levelL2
) to organize the report hierarchically. - Retrieves company name (
BCNAME
) fromBICONT
and location name (ILNAME
) fromINLOC
using keys (XXCO
,ILKEY
).
- Processes records by company (
- Retrieve Product Group Description:
- Uses
XXPRGR
to chain toGSTABL
forTBDES1
(stored asGRPDSC
).
- Uses
- Retrieve Container Description:
- Uses
XXCNTR
to chain toGSCNTR1
forTCDESC
(stored asCNTDSC
).
- Uses
- Retrieve Cost Data:
- Uses
GCLMCC
(last closed month) fromGLCONT
and matches withGICYR
,GIMO
fromICSUMHY
to retrieve cost per gallon (GICPGP
,GICPGC
).
- Uses
- Retrieve Tax Data:
- Reads
BB9518
to match company (B8CONO
), state (B8STAT
), and product group (TBPRGP
) for tax codes (TXC
), descriptions (TXD
), rates (TXR
), and delivery flag (B8DELV
). - Calculates total tax rate (
TOTTXR
) by summingTXR
elements.
- Reads
- Format Quantities:
- Processes
XXQT
(quantities) intoQTY
headings, handling beginning/end flags (BQT
,EQT
) to format ranges (e.g., per FHL082198 fix for 5-byte quantities).
- Processes
- Print Report:
- Outputs headers (
PRTHDR
) for program, company, location, product group, and columns. - Outputs detail lines (
PRTLN1
,PRTLN2
) for current and previous prices, quantities, and flags. - Outputs tax information (
PRTTXH
,PRTTX
) and separators (PRTSEP
).
- Outputs headers (
-
Write to
BBPRCEC
:- Stores report data (company, location, product, prices, quantities, etc.) in
BBPRCEC
for salesmen’s pricing reports.
- Stores report data (company, location, product, prices, quantities, etc.) in
-
Program Termination:
- Completes after processing all
BB9511
records, closing files and ending the print job.
Business Rules¶
The RPG program enforces the following business rules for the rack price report:
- Two Price Changes:
-
Displays the last two price changes (
XXPR
,PRPR
) for each product (XXPROD
), container (XXCNTR
), and unit of measure (XXUNMS
) within two print lines for easy customer quoting. -
Hierarchical Structure:
-
Organizes the report by company (
XXCO
), location (XXLOC
), and product group (XXPRGR
), with headers for each level. -
Descriptive Data:
-
Retrieves company name (
BCNAME
) fromBICONT
, location name (ILNAME
) fromINLOC
, product group description (TBDES1
) fromGSTABL
, and container description (TCDESC
) fromGSCNTR1
. -
Tax Information:
- Includes up to 10 tax codes (
TXC
), descriptions (TXD
), and rates (TXR
) fromBB9518
, with a total tax rate (TOTTXR
). -
Indicates delivery applicability (
B8DELV
). -
Cost Data:
-
Retrieves cost per gallon (
GICPGP
,GICPGC
) fromICSUMHY
for the last closed costing month (GCLMCC
fromGLCONT
). -
Quantity Formatting:
-
Formats quantities (
XXQT
) into ranges usingQTY
,BQT
, andEQT
, handling up to 5-digit quantities (per FHL082198). -
Flags:
-
Indicates if a product is inactive (
XXINAC = 'I'
or'B'
), or if rack pricing is not required (XXRKRQ
). -
Output to Table:
- Stores report data in
BBPRCEC
for salesmen’s pricing reports, including prices, quantities, descriptions, and cost data.
Tables/Files Used¶
The RPG program uses the following files:
1. BB9511 (?9?BB951S
): Primary input temporary file, containing preprocessed rack price data (company, location, product, prices, quantities, etc.).
2. BICONT (?9?BICONT
): Input company file, provides company name (BCNAME
).
3. INLOC (?9?INLOC
): Input location file, provides location name (ILNAME
).
4. GSTABL (?9?GSTABL
): Input table file, provides product group descriptions (TBDES1
).
5. BB9518 (?9?BB9518
): Input temporary tax file, provides tax codes, descriptions, rates, and delivery flags.
6. GLCONT (?9?GLCONT
): Input general ledger control file, provides last closed costing month (GCLMCC
).
7. ICSUMHY (?9?ICSUMHY
): Input summary history file, provides cost per gallon data (GICPGP
, GICPGC
).
8. GSCNTR1 (?9?GSCNTR1
): Input container file, provides container descriptions (TCDESC
).
9. BBPRCEC (?9?BBPRCEC
): Output table file, stores report data for salesmen.
10. LIST: Printer output file, generates the rack price report.
External Programs Called¶
The RPG program does not explicitly call any external programs. It performs file operations (READ
, CHAIN
, EXCPT
) and writes to the printer (LIST
) and output table (BBPRCEC
). It is called by the BB951.ocl36.txt
OCL program as the final step in the rack price list process.
Summary¶
- Process Overview: The
BB951
RPG program generates a rack price report by processing preprocessed data fromBB9511
, retrieving company, location, product group, container, cost, and tax information from reference files, and printing a formatted report viaLIST
. It also stores data inBBPRCEC
for salesmen’s reports. The report shows the last two price changes within two lines, including quantities, tax details, and status flags. - Business Rules: Organizes data hierarchically, displays current and previous prices, includes tax and cost data, formats quantities, and handles inactive/rack-not-required flags. Outputs to both printer and table.
- Files/Tables:
BB9511
,BICONT
,INLOC
,GSTABL
,BB9518
,GLCONT
,ICSUMHY
,GSCNTR1
,BBPRCEC
,LIST
. - External Programs: None called directly.
Due to the truncation, some processing logic (e.g., main loop, calculations) is inferred. If you can provide the missing code or specific details (e.g., file structures, PRTLN1
calculations), I can refine the analysis. Alternatively, I can search for related information if desired!