BB715 RPG36
The BB715.rpg36.txt
is an RPG program (for IBM System/36 or AS/400) called by the BB715.ocl36.txt
OCL program to generate the final "Daily Requirements Report." It processes sorted order data from BBORDR
(mapped to BB715S
), combines it with inventory data from various files, and produces a formatted report via the LIST
printer file. Below, I’ll explain the process steps, business rules, tables (files) used, and external programs called, incorporating insights from the provided OCL and related RPG programs (BB715P
, BB713
, BB714
, BB714A
).
Process Steps of the RPG Program¶
The BB715
RPG program reads sorted order data, retrieves additional data from inventory and reference files, calculates daily and weekly quantities, and generates a report with tank inventory and availability. Due to the truncated code (27,234 characters missing), I’ll focus on the provided specifications, output definitions, and context from the OCL and related programs, making reasonable inferences for the missing logic.
- Program Initialization:
- Header (H-spec): Line 0002 defines the program name (
BB715
) and page length (P064
). - File Definitions (F-spec):
BBORDR
: Primary input file (530 bytes, disk, mapped toBB715S
in OCL, Line 0004).BICONT
: Input file (256 bytes, indexed with 2 keys, disk, Line 0005).GSTABL
: Commented out, replaced byGSPROD
(Line JK02).INLOC
: Input file (512 bytes, indexed with 5 keys, disk, Line 0007).INTKRY
,INTKRW
: Input files (128 bytes, indexed with 25 and 21 keys, externally described, disk, Line 0006).GSCTUM
: Input file (64 bytes, indexed with 12 keys, disk, Line 0010).INCHRT
: Input file (512 bytes, indexed with 9 keys, disk, Line 0008).GSCNTR1
: Input file (512 bytes, indexed with 3 keys, disk, Line JK01).GSPROD
: Input file (512 bytes, indexed with 6 keys, disk, Line JK02).LIST
: Output printer file (164 bytes, Line 0008).
- Array Definitions (E-spec):
DAY
: 1x7 array, 3 characters, holding day names (e.g., 'THU', 'FRI', Lines 0009, post-0419).DYN
: 5x3 array for day names in report headers (Line 0011).DTE
: 5x4 array for MMDD dates (Line 0012).DT8
: 5x8 array for CYMD dates (Line 0013).
-
Input Definitions (I-spec):
BBORDR
(Lines 0014–0031):BDDEL
(1): Delete flag.BDCO
(2–3): Company number (level break L7).BDORD#
(4–9): Order number.BDSEQ
(10–12): Detail line sequence.BDLOC
(22–24): Location (level break L5).BDPROD
(25–28): Product code (level break L1).BDTANK
(29–32): Tank code.BDQTY
(35–41): Container quantity.BDPRCE
(42–50): Price.BDUM
(51–53): Unit of measure (level break L2).BDCSTK
(54–73): Customer stock number.BDDESC
(75–104): Description.BDCNTR
(121–123): Container code (level break L3).BDRQD8
(513–520): Request date (CYMD).BLKPKG
(521): Bulk/packaged indicator ('B' or 'P', fromBB714A
).REFBLD
(522–523): Customer sort code (fromBB714A
).BICONT
(Line 0033):BCNAME
(4–33): Company name.INLOC
(Line 0036):ILNAME
(7–26): Location name.INTKRY
,INTKRW
(Lines 0061–0088): Inventory transaction fields (e.g.,IXCO
,IXLOC
,IXPRCD
,IXTANK
,IXCNTR
,IXDATE
,IXQTFT
,IXQTSE
, etc.).GSPROD
,GSCNTR1
,GSCTUM
,INCHRT
: Provide reference data (e.g., product class, container type, unit of measure, tank chart data).
-
Main Processing Loop (Inferred from Output and Context):
- Level Breaks: Uses indicators L1 (
BDPROD
), L2 (BDUM
), L3 (BDCNTR
), L4 (BLKPKG
), L5 (BDLOC
), L6 (REFBLD
), L7 (BDCO
) to group records for reporting. - Inventory Lookup (L1TANK Subroutine):
- Chains
INTKRY
/INTKRW
using keys likeIXCO
,IXLOC
,IXPRCD
,IXTANK
, andIXCNTR
to retrieve inventory quantities (IXQTFT
,IXQTSE
) and tank measurements (IXTOFT
,IXTOIN
, etc.). - Chains
INCHRT
to get tank capacity (TCSP1
) and calculate available inches (AVALIN = IXTOFT - TCSP1
). - Computes available product (
FACT2 = (AVALIN * IXQTTA) / IXTOFT
) and updatesL1XINV
andL2XINV
(Lines post-truncation). - If
INCHRT
lookup fails (99
), usesIXQTSE
directly for inventory (Line 0360).
- Chains
- Quantity Calculations:
- Accumulates quantities (
D1QTY
toD5QTY
) for five days based onBDRQD8
(request date). - Computes weekly totals (
L1QTY
,L2QTY
) and overage (OVQTY
,L2VQTY
). - Calculates differences:
L1DIFF = L1XINV - L1QTY - OVQTY
,L2DIFF = L2XINV - L2QTY - L2VQTY
(Lines 0334, post-0335).
- Accumulates quantities (
-
Subroutines:
L1TANK
: Calculates tank inventory (L1XINV
,L2XINV
) usingINTKRY
,INTKRW
, andINCHRT
.L2TOTL
: Computes unit of measure totals and differences (L2HOLD
,L2DIFF
, Lines post-0335).
-
Report Output (LIST):
- Headers (L4, Lines 0338–0387):
- Company header:
BCNAME
, report title, page number (PAGE
), system date (SYSDATY
), and time (SYSTIM
). - Column headers: 'CNTR/PROD', 'DESCRIPTION', 'TODAY', day names (
DYN,2
toDYN,5
), 'WEEK TOTAL', 'LATER', 'TANK INV.', 'BALANCE'. - Date headers:
DTE,1
toDTE,5
(MMDD format), 'ON ORDER', 'AVAILABLE'.
- Company header:
- Detail Lines (L1, Line 0389):
- Prints container (
BDCNTR
), product (BDPROD
), description (L1CNDS
,L1PDSC
), unit of measure (BDUM
). - Daily quantities (
D1QTY
toD5QTY
), weekly total (L1QTY
), overage (OVQTY
). - Tank inventory (
L1XINVMB
) and balance (L1DIFFMB
), suppressed if indicator 50 is off.
- Prints container (
-
Total Lines (L2, Lines 0402–0419):
- Prints unit of measure totals (
L21QTY
toL25QTY
,L2QTY
,L2VQTY
), inventory (L2XINVMB
), and balance (L2DIFFMB
). - Includes separator lines for clarity.
- Prints unit of measure totals (
-
Program Termination:
- Ends when all
BBORDR
records are processed or a control break occurs, closing theLIST
file.
Business Rules¶
- Data Grouping:
- Groups records by company (
BDCO
, L7), location (BDLOC
, L5), customer sort code (REFBLD
, L6), bulk/packaged (BLKPKG
, L4), container (BDCNTR
, L3), unit of measure (BDUM
, L2), and product (BDPROD
, L1). - Inventory Calculation:
- Uses
INTKRY
/INTKRW
to retrieve tank quantities (IXQTFT
,IXQTSE
) and measurements (IXTOFT
,IXTOIN
). - Uses
INCHRT
to calculate available product based on tank capacity (TCSP1
) and inches (AVALIN
). - Falls back to
IXQTSE
ifINCHRT
data is unavailable. - Quantity Aggregation:
- Accumulates daily quantities (
D1QTY
toD5QTY
) based onBDRQD8
for a five-day period. - Computes weekly totals (
L1QTY
,L2QTY
) and overage (OVQTY
,L2VQTY
). - Calculates available balance (
L Hawkins,
L1DIFF,
L2DIFF`) after subtracting ordered quantities and overage from inventory. - Report Format:
- Includes company and location details, daily and weekly order quantities, tank inventory, and available balance.
- Suppresses inventory and balance fields if indicator 50 is off (likely for non-inventory scenarios).
- Data Validation:
- Relies on
BB715P.rpg36.txt
for input validation (company, date, job queue). - Excludes deleted records (
BDDEL ≠ 'D'
,IXDEL ≠ 'D'
, etc.).
Tables (Files) Used¶
- Input Files:
BBORDR
(mapped toBB715S
): Sorted order data (530 bytes).- Fields:
BDDEL
,BDCO
,BDORD#
,BDSEQ
,BDLOC
,BDPROD
,BDTANK
,BDQTY
,BDPRCE
,BDUM
,BDCSTK
,BDDESC
,BDCNTR
,BDRQD8
,BLKPKG
,REFBLD
.
- Fields:
BICONT
: Company data (256 bytes).- Field:
BCNAME
.
- Field:
INLOC
: Location data (512 bytes).- Field:
ILNAME
.
- Field:
INTKRY
,INTKRW
: Inventory transaction files (128 bytes).- Fields:
IXDEL
,IXCO
,IXLOC
,IXPRCD
,IXTANK
,IXCNTR
,IXXKEY
,IXDATE
,IXQTFT
,IXQTSE
, etc.
- Fields:
GSCTUM
: Unit of measure data (64 bytes).INCHRT
: Tank chart data (512 bytes).- Field:
TCSP1
(tank capacity).
- Field:
GSCNTR1
: Container type data (512 bytes).-
GSPROD
: Product data (512 bytes). -
Output File:
LIST
: Printer file (164 bytes) for the report.
External Programs Called¶
- MINCHT: Implied by OCL file definitions (
MINCHRT
,MINSTRP
,ICSUMHY
), likely for tank chart or inventory processing, though not explicitly called in the provided code.
Notes¶
- Change History:
- 11/04: Added inventory fields for easier reading.
- 04/18/16 (JK01): Replaced
GSTABL
withGSCNTR1
for container type. - 01/18/23 (JK02): Replaced
GSTABL
withGSPROD
for product data. - Integration with OCL: The OCL program (
BB715.ocl36.txt
) callsBB715
after preprocessing (BB713
,BB714
,BB714A
,#GSORT
) to generate the final report fromBB715S
. - Truncation: The missing 27,234 characters likely include the main processing loop, additional subroutines, and logic for chaining files and accumulating quantities. The output specs and context provide sufficient insight into the report structure.
- Error Handling: Relies on
BB715P
for input validation; inventory lookups use indicator 99 for missingINCHRT
records.
Summary¶
The BB715
RPG program generates the Daily Requirements Report by processing sorted order data (BBORDR
/BB715S
), retrieving inventory from INTKRY
/INTKRW
and INCHRT
, and calculating daily/weekly quantities and tank availability. It uses level breaks for grouping and outputs a formatted report via LIST
. Files used include BBORDR
, BICONT
, INLOC
, INTKRY
, INTKRW
, GSCTUM
, INCHRT
, GSCNTR1
, GSPROD
, and LIST
. The only implied external program is MINCHT
.
Files Used: BBORDR
, BICONT
, INLOC
, INTKRY
, INTKRW
, GSCTUM
, INCHRT
, GSCNTR1
, GSPROD
, LIST
.
External Programs: MINCHT
(implied).
If you have the missing code or additional files (e.g., MINCHT
), I can provide a more detailed analysis. Let me know!