BB714 RPG36
The provided BB714.rpg36.txt
is an RPG program (for IBM System/36 or AS/400) called by the BB715.ocl36.txt
OCL program as part of the preprocessing for the "Daily Requirements Report." Its primary function is to convert quantities from pounds (LBS) to gallons (GAL) for specific orders in the BB713M
file, using conversion factors from the GSUMCV
file, and update the unit of measure and container code as needed. Below, I’ll explain the process steps, business rules, tables (files) used, and external programs called.
Process Steps of the RPG Program¶
The BB714
RPG program processes records from BB713M
, applies unit conversions for specific conditions, and updates the output file. Here’s a step-by-step breakdown:
- Program Initialization:
- Header (H-spec): Line 0002 defines the program name (
BB714
) and page length (P064
). - File Definitions (F-spec):
BB713M
: Update file (input/output, 530 bytes, disk, Line 0008).GSUMCV
: Input file (64 bytes, indexed with 12 keys, disk, Line 0010).
- Input Definitions (I-spec):
BB713M
(Lines 0017–0029):BDDEL
(1): Delete flag ('D' for deleted).BDCO
(2–3): Company number.BDORD#
(4–9): Order number.BDSEQ
(10–12): Detail line sequence.BDLOC
(22–24): Location.BDPROD
(25–28): Product code.BDTANK
(29–32): Tank code.BDQTY
(35–41): Container quantity.BDPRCE
(42–50): Price.BDUM
(51–53): Unit of measure (e.g., 'LBS', 'GAL').BDCSTK
(54–73): Customer stock number.BDDESC
(75–104): Description.BDCNTR
(121–123): Container code.GSUMCV
(Lines 0016–0025):UCKEY
(2–13): Key field.UCDEL
(1): Delete flag ('D' for deleted).UCCONO
(2–3): Company number.UCPROD
(4–7): Product code.UCFUNM
(8–10): From unit of measure.UCTUNM
(11–13): To unit of measure.UCOPER
(14): Operand ('M' for multiply, 'D' for divide).UCCVFA
(15–26): Conversion factor.
-
Indicators:
01
: Triggers record processing.02
: Skips to program end.78
: Set for specific condition (BDPROD = '4317'
,BDUM = 'LBS'
,BDQTY = 49000
).99
: Indicates chain failure onGSUMCV
.
-
Main Processing Loop (Lines 0043–end of C-specs):
- Condition: Indicator 02 on skips to
END
tag, terminating the program (Line 0043). -
Processing for Indicator 01 (Line 0045):
- Special Case Check (Lines 0045–0049):
- If
BDPROD = '4317'
,BDUM = 'LBS'
, andBDQTY = 49000
, sets indicator 78 and skips further processing for the record. - Pounds to Gallons Conversion (Lines 0050–0058):
- If
BDUM = 'LBS'
andBDCNTR = '001'
:- Builds a key (
KEY12
) combiningBDCO
andBDPROD
with 'LBSGAL' (Lines 0052–0055). - Chains
GSUMCV
usingKEY12
to find a conversion factor (Line 0056). - If found (
N99
): - Divides
BDQTY
byUCCVFA
to getQTY
(gallons, Line 0057). - Writes an exception output
ONE
toBB713M
, updating:BDUM
to 'GAL' (position 51–53).BDQTY
toQTY
(position 35–41).BDCNTR
to '001' (position 121–123).
- Jumps to
END
to process the next record (Line 0058).
- Builds a key (
- Gallons with Container Code '002' (Lines 0059–0062):
- If
BDUM = 'GAL'
andBDCNTR = '002'
:- Writes an exception output
TWO
toBB713M
, updating: BDCNTR
to '001' (position 121–123).- No quantity conversion is performed.
- Writes an exception output
- End of Loop: Continues to the next
BB713M
record until indicator 02 is set or end-of-file.
-
Output to BB713M:
- Exception Output
ONE
(Lines post-0062):- Updates
BB713M
record with: BDUM = 'GAL'
(position 53).BDQTY = QTY
(position 41, converted quantity).BDCNTR = '001'
(position 123).
- Updates
-
Exception Output
TWO
(Lines post-0062):- Updates
BB713M
record with: BDCNTR = '001'
(position 123).
- Updates
-
Program Termination:
- The
END
tag is reached when indicator 02 is set or all records are processed, ending the program.
Business Rules¶
- Special Case for Product 4317:
- If the product code is '4317', unit of measure is 'LBS', and quantity is exactly 49,000, indicator 78 is set, and no further conversion is performed for that record.
-
This likely flags a specific condition (e.g., a standard batch size) that bypasses conversion.
-
Pounds to Gallons Conversion:
- For records with
BDUM = 'LBS'
andBDCNTR = '001'
:- Looks up a conversion factor in
GSUMCV
using a key combining company number (BDCO
), product code (BDPROD
), and 'LBSGAL'. - Converts quantity (
BDQTY
) to gallons by dividing by the conversion factor (UCCVFA
). - Updates the record to
BDUM = 'GAL'
andBDCNTR = '001'
.
- Looks up a conversion factor in
-
If no conversion factor is found (
99
on), skips conversion and moves to the next record. -
Gallons with Container Code '002':
-
For records with
BDUM = 'GAL'
andBDCNTR = '002'
:- Updates the container code to '001' without changing the quantity.
- This ensures consistency in container codes for gallon-based records.
-
Record Skipping:
- Records not matching the above conditions (e.g.,
BDUM ≠ 'LBS'
or 'GAL', orBDCNTR ≠ '001'
or '002') are not updated and pass through unchanged.
Tables (Files) Used¶
- Input Files:
BB713M
: Update file (530 bytes), contains order data to be processed.- Fields:
BDDEL
(1),BDCO
(2–3),BDORD#
(4–9),BDSEQ
(10–12),BDLOC
(22–24),BDPROD
(25–28),BDTANK
(29–32),BDQTY
(35–41),BDPRCE
(42–50),BDUM
(51–53),BDCSTK
(54–73),BDDESC
(75–104),BDCNTR
(121–123).
- Fields:
-
GSUMCV
: Input file (64 bytes, indexed with 12 keys), contains unit conversion factors.- Fields:
UCKEY
(2–13),UCDEL
(1),UCCONO
(2–3),UCPROD
(4–7),UCFUNM
(8–10),UCTUNM
(11–13),UCOPER
(14),UCCVFA
(15–26).
- Fields:
-
Output File:
BB713M
: Updated with exception outputsONE
andTWO
:ONE
: SetsBDUM = 'GAL'
,BDQTY = QTY
,BDCNTR = '001'
.TWO
: SetsBDCNTR = '001'
.
External Programs Called¶
- None: The
BB714
program does not explicitly call other programs. It performs all processing internally using file I/O and exception outputs.
Notes¶
- Integration with OCL: The
BB715.ocl36.txt
callsBB714
afterBB713
to convert quantities inBB713M
from pounds to gallons, preparing data for subsequent steps (BB714A
,#GSORT
,BB715
). - Error Handling: Uses indicator 99 to handle missing conversion factors in
GSUMCV
. No explicit error messages are output, as this is a preprocessing step. - Limited Scope: The program only processes records with specific conditions (
BDUM = 'LBS'
or 'GAL',BDCNTR = '001'
or '002'), leaving others unchanged. - Conversion Logic: Assumes
UCOPER = 'D'
(divide) for LBS-to-GAL conversion, as implied by the division operation (BDQTY / UCCVFA
).
Summary¶
The BB714
RPG program processes BB713M
records to convert quantities from pounds to gallons for specific conditions (BDUM = 'LBS'
, BDCNTR = '001'
) using conversion factors from GSUMCV
, updates the unit of measure to 'GAL', and standardizes container codes to '001'. It also handles a special case for product '4317' with 49,000 LBS. The program uses BB713M
and GSUMCV
files, updates BB713M
, and calls no external programs.
Files Used: BB713M
, GSUMCV
.
External Programs: None.
If you need further details (e.g., conversion factor format, subsequent programs like BB714A
), or additional files, let me know!