BB802B RPGLE
The BB802B RPGLE program is a component of the Customer Orders and Invoicing system, designed to populate a work file (BB802W
) with open order detail data from the BB802BQF
file, which is a logical file joining BBORDD
(order details) and BBORDH
(order headers). It is called by the BB802C CLP program, which sets up the query environment and file overrides. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.
Process Steps of the BB802B RPG Program¶
The program reads records from the BB802BQF
file, processes them based on a level break (L1), and updates or adds corresponding records to the BB802W
work file. The steps are focused on data transfer with no user interaction. Here’s a breakdown of the key process steps:
- Initialization (
*inzsr
Subroutine): - Purpose: Sets up the program environment and initializes variables.
-
Actions:
- Receives the input parameter:
p$fgrp
(1 character, file group: 'G' or 'Z'). - Defines a key list (
klwrk
) for accessing the work fileBB802W
, using fields:bdco
(company),bocust
(customer),bdordn
(order number), andboinvn
(invoice number).
- Receives the input parameter:
-
Main Processing Loop:
- Purpose: Reads
BB802BQF
records and processes them based on a level break. -
Actions:
- Reads
BB802BQF
records sequentially, with level break indicators (L1
) set on fieldsbdco
,bocust
,bdordn
, andboinvn
. - When the level break indicator
*inl1
is on, executes theupdwrkf
subroutine to process the record.
- Reads
-
Update Work File (
updwrkf
Subroutine): - Purpose: Adds or updates records in the
BB802W
work file based onBB802BQF
data. -
Actions:
- Uses the
klwrk
key list (bdco
,bocust
,bdordn
,boinvn
) to check if a matching record exists inBB802W
usingSETLL
(sets*in99
if no match). - If no matching record exists (
*in99 = *off
), chains toBB802W
to verify existence (*in99 = *on
if not found). - If the record does not exist (
*in99 = *on
): - Clears the
BB802W
record format (bb802wpf
). - Maps fields from
BB802BQF
toBB802W
:w1co
←bdco
(company)w1cust
←bocust
(customer)w1ord#
←bdordn
(order number)w1inv#
←boinvn
(invoice number)w1ship
←boship
(ship-to code)w1pord
←bopord
(purchase order)w1slmn
←boslmn
(salesman)w1crid
←bortg1
(carrier ID)w1carn
←bocar
(carrier name)w1sdat
←borqd8
(request date)w1frcd
←bofrcd
(freight code)w1sfrt
←bosfrt
(ship freight)w1cafr
←bocafr
(carrier freight)w1cacd
←bocacd
(carrier code)w1loc
←bdloc
(location)w1prod
←bdprod
(product)w1cntr
←bdcntr
(container)w1qty
←bdqty
(quantity, added by jk01)w1um
←bdum
(unit of measure, added by jk01)w1oori
←'O'
(order origin indicator)- Additional fields (per jk02):
w1tkby
←botkby
(taken by)w1rush
←borush
(rush order flag)w1gpby
←bogpby
(group by)w1racd
←boracd
(reason code)w1mulo
←bomulo
(multi-order flag)w1mlcd
←bomlcd
(multi-code)w1tolo
←botolo
(total order)w1loda
←boloda
(load date)w1lovo
←bolovo
(load volume)
- Writes the new record to
BB802W
(write bb802wpf
). - If a matching record exists (
*in99 = *off
), no update is performed (implicitly skips to the next record).
- Uses the
-
Program Termination:
- Purpose: Completes processing and exits.
- Actions:
- Ends the program after processing all
BB802BQF
records, closing files implicitly (asBB802BQF
andBB802W
are defined withip
anduf
respectively).
- Ends the program after processing all
Business Rules¶
- Work File Population:
- The program adds records to
BB802W
fromBB802BQF
(joiningBBORDD
andBBORDH
) for open order details, preserving the invoice number (boinvn
) from the header. -
Only adds new records if no matching record exists in
BB802W
(based onbdco
,bocust
,bdordn
,boinvn
). -
Level Break Processing:
- Processes
BB802BQF
records on a level break (L1
) defined bybdco
(company),bocust
(customer),bdordn
(order number), andboinvn
(invoice number). -
Ensures records are processed only when the level break occurs, optimizing performance.
-
Field Mapping:
- Maps fields from
BB802BQF
toBB802W
, including both header (BBORDH
) and detail (BBORDD
) data (e.g., customer, order, ship-to, product, quantity). -
Includes additional fields added in revisions jk01 (quantity, unit of measure) and jk02 (taken by, rush flag, load volume, etc.) to support enhanced inquiry capabilities.
-
File Group Handling:
-
Relies on
p$fgrp
('G' or 'Z') set by BB802C to access the correct library (GBBORDD
,GBBORDH
orZBBORDD
,ZBBORDH
) via overrides in the CLP. -
Data Integrity:
- Uses
SETLL
andCHAIN
to ensure no duplicate records are written toBB802W
. -
Clears the record format before writing to prevent residual data.
-
Revision-Specific Rules:
- jk01: Added
w1qty
(quantity) andw1um
(unit of measure) toBB802W
to include order detail quantities. - jk02: Added fields to
BB802W
(w1tkby
,w1rush
,w1gpby
,w1racd
,w1mulo
,w1mlcd
,w1tolo
,w1loda
,w1lovo
) to capture additional order header data (e.g., taken by, rush flag, load volume).
Tables Used¶
The program accesses the following database files:
- BB802BQF: Logical file (input primary,
ip
), joinsBBORDD
(order details) andBBORDH
(order headers), containing fields likebdco
,bocust
,bdordn
,boinvn
,bdloc
,bdprod
, etc. - BB802W: Work file (update file,
uf
), stores processed inquiry data inQTEMP
with fields likew1co
,w1cust
,w1ord#
,w1inv#
,w1qty
, etc.
External Programs Called¶
The program does not call any external programs. It operates independently, relying on file I/O operations and the environment set up by BB802C (e.g., file overrides and open query).
Additional Notes¶
- Indicator Usage: Uses
*inl1
for level break processing and*in99
for file access control (SETLL
andCHAIN
operations). - Field Prefixes: Uses
w1
prefix forBB802W
fields, aligning with the work file structure. - Key List: The
klwrk
key list ensures unique identification of records inBB802W
usingbdco
,bocust
,bdordn
, andboinvn
. - Context: Called by BB802C in
ORD
mode (open order detail processing), whereBB802BQF
is queried with a selection string (QRYSLT
) to filter records. - Efficiency: The program uses a simple, non-interactive approach, focusing on data transfer to the work file, with no user interface or message handling.
This program is a critical backend component of the inquiry system, ensuring that open order detail data is efficiently transferred to the BB802W
work file for further processing by the BB802 inquiry interface.