BB802I RPGLE
The BB802I RPGLE program is a component of the Customer Orders and Invoicing system, designed to populate a work file (BB802W
) with canceled order detail data from the BB802IQF
file, which is a logical file joining BBCND
(canceled order details), BBCNH
(canceled order headers), and BBCNOR
(canceled order reasons). It is called by the BB802C CLP program in CND
mode (canceled order detail processing) and is noted as being cloned from BB802B with modifications for canceled orders. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.
Process Steps of the BB802I RPG Program¶
The program reads records from the BB802IQF
file, processes them based on a level break (L1), and adds records to the BB802W
work file. The steps focus 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
BB802IQF
records and processes them based on a level break. -
Actions:
- Reads
BB802IQF
records sequentially, with level break indicators (L1
) set on fieldsbdco
(company),bocust
(customer),bdordn
(order number), andboinvn
(invoice number). - When the level break indicator
*inl1
is on, executes theupdwrkf
subroutine to process the record.
- Reads
-
Update Work File (
updwrkf
Subroutine): - Purpose: Adds records to the
BB802W
work file based onBB802IQF
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
BB802IQF
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)w1cnrs
←bccnrs
(cancel reason)w1loc
←bdloc
(location)w1prod
←bdprod
(product)w1cntr
←bdcntr
(container)w1um
←bdum
(unit of measure)w1qty
←bdqty
(quantity)w1oori
←'C'
(canceled order origin indicator)- Additional fields (per jk01):
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
BB802IQF
records, closing files implicitly (asBB802IQF
andBB802W
are defined withip
anduf
respectively).
- Ends the program after processing all
Business Rules¶
- Work File Population:
- The program adds records to
BB802W
fromBB802IQF
(joiningBBCND
,BBCNH
, andBBCNOR
) for canceled order details, using the invoice number (boinvn
) as a key component. -
Only adds new records if no matching record exists in
BB802W
(based onbdco
,bocust
,bdordn
,boinvn
). -
Level Break Processing:
- Processes
BB802IQF
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
BB802IQF
, combining detail data (BBCND
: e.g.,bdloc
,bdprod
,bdqty
) and header data (BBCNH
: e.g.,bopord
,boslmn
,borqd8
) with cancel reason (bccnrs
fromBBCNOR
). - Includes additional fields added in revision jk01 (
w1tkby
,w1rush
,w1gpby
, etc.) to support enhanced inquiry capabilities. -
Sets
w1oori = 'C'
to indicate the record originates from a canceled order. -
File Group Handling:
-
Relies on
p$fgrp
('G' or 'Z') set by BB802C to access the correct library (GBBCND
,GBBCNH
,GBBCNOR
orZBBCND
,ZBBCNH
,ZBBCNOR
) 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.
-
Cloned from BB802B:
- The program is cloned from BB802B (which processes open order details from
BBORDD
/BBORDH
) but adapted for canceled order details (BBCND
/BBCNH
). -
Key differences include:
- Uses
BB802IQF
instead ofBB802BQF
. - Adds
w1cnrs
(cancel reason) toBB802W
. - Sets
w1oori = 'C'
instead of'O'
. - Includes
w1qty
andw1um
directly (not as a revision, unlike BB802B where they were added in jk01).
- Uses
-
Revision-Specific Rules:
- jk01: Added fields to
BB802W
(w1tkby
,w1rush
,w1gpby
,w1racd
,w1mulo
,w1mlcd
,w1tolo
,w1loda
,w1lovo
) to capture additional canceled order data (e.g., taken by, rush flag, load volume).
Tables Used¶
The program accesses the following database files:
- BB802IQF: Logical file (input primary,
ip
), joinsBBCND
(canceled order details),BBCNH
(canceled order headers), andBBCNOR
(canceled order reasons), containing fields likebdco
,bocust
,bdordn
,boinvn
,bdloc
,bdprod
,bccnrs
, etc. - BB802W: Work file (update file,
uf
), stores processed inquiry data inQTEMP
with fields likew1co
,w1cust
,w1ord#
,w1inv#
,w1cnrs
,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
CND
mode (canceled order detail processing), whereBB802IQF
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.
- Relation to BB802B: As a clone of BB802B, it follows a similar structure but is tailored for canceled order details, with the addition of the cancel reason field (
w1cnrs
) and a different origin indicator (w1oori = 'C'
).
This program is a critical backend component of the inquiry system, ensuring that canceled order detail data is efficiently transferred to the BB802W
work file for further processing by the BB802 inquiry interface.