BB201 RPG36
The BB201.rpg36.txt
RPG program is called by the main OCL program (likely BB600.ocl36.txt
) within the invoice posting workflow on an IBM System/36 environment. Its primary function is to update the order master file (BBORDR
) and customer order file (CUSORD
) based on transactions from the order transaction file (BBORTR
). It also manages supplemental and accessorial data, deletes historical order records when appropriate, and previously printed an Order Update Register (discontinued per JB10
). The program includes several revisions to handle new fields, multi-load orders, and duplicate order checking. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.
Process Steps of the BB201 RPG Program¶
The BB201
program processes order transactions from BBORTR
, updates order and customer files, manages supplemental and accessorial data, and deletes historical records for duplicate checking. It incorporates revisions for field initialization, new data fields, and discontinued reporting.
- File Initialization:
- The program opens multiple files (exact definitions are partially truncated, but key files are inferred from output specifications and context):
- Input/Update Files:
BBORTR
: Primary input file (UP
), contains order transaction records.BBORDR
: Update file, order master file, created or updated if it exists.CUSORD
: Update file (UC
), stores customer order data, updated with status and dates.BBORCL
: Update file, credit limit cross-reference file, updated for totals.BBORHS1
: Update file, supplemental header file, supports add/delete (A
).BBORDS1
: Update file, supplemental detail file, supports add/delete (A
).BBORDH
: Update file, order header file, supports add (A
, perMG19
).BBORHHS
: Update file, additional header supplemental file (perMG19
).BBORMHS
: Update file, marks supplemental file (perMG19
).BBOH
: Order history file, used for duplicate order checking, subject to deletion (perDC02
,JB12
).- Output Files:
- None explicitly for printing, as the Order Update Register was discontinued (per
JB10
).
-
Key fields (from output specifications):
XXSTAT
: Order status.CN
: Company number.YMD
: Date in YMD format.SYCYMD
: System date in YMD format.SYSTIM
: System time.USERID
: User ID.WSID
: Workstation ID.BOCUST
: Customer number.BOSHIP
: Ship-to code.BODEL
: Delete flag.Z2
,Z92
: Zero-filled fields (likely for totals or counters).CRTOTL
: Credit total.BODTA1
,BODTA2
: Supplemental header data (256 and 512 bytes).BDDTA1
,BDDTA2
: Supplemental detail data (256 and 512 bytes).BMDTA1
,BMDTA2
: Marks supplemental data (256 and 512 bytes).BDLINE
,BDQTY
,BDQTYS
,BDQTYB
,BDQTUM
,BDPRWT
, etc.: Detail fields (perJB09
).IN11
: Fluid code or IMS unit of measure (perVV04
).RUSH
,OPCODE
: Rush order and order process code (perDC01
).INCOTM
: Incoterms code (perJB07
).BMFAMT
: Miscellaneous freight amount (perJB14
).
-
Record Processing (BBORTR):
- Reads order transaction records from
BBORTR
sequentially using the RPG cycle. - Processes transactions to update order master (
BBORDR
) and customer order (CUSORD
) files. -
Identifies new or existing orders for updates or deletions.
-
Order Master Update (BBORDR):
- Creates or updates
BBORDR
with transaction data fromBBORTR
. - Transfers fields such as customer number (
BOCUST
), ship-to code (BOSHIP
), and new fields likeRUSH
,OPCODE
(perDC01
),INCOTM
(perJB07
), and detail fields (perJB09
, e.g.,BDQTUM
,BDPRWT
,BMFAMT
). -
Updates order detail with fluid code and IMS unit of measure (
IN11
, perVV04
). -
Customer Order Status Update (CUSORD):
-
Updates
CUSORD
(E STSUPD
orE STSDEL
):- For active orders: Sets status (
XXSTAT
), company number (CN
), and date (YMD
) with entry type'A'
(E STSUPD
). - For deleted orders: Sets delete flag to
'D'
(E STSDEL
).
- For active orders: Sets status (
-
Supplemental and Accessorial Data (per JB06, JB09, MG19):
- Adds or updates records in:
BBORHS1
: Supplemental header (EADD
, fieldsBODTA1
,BODTA2
).BBORDS1
: Supplemental detail (EADD
, fieldsBDDTA1
,BDDTA2
).BBORHHS
: Additional header supplemental (DADD 01
, fieldsBODTA1
,BODTA2
,BOCUST
,BOSHIP
,'A'
,'Y'
,SYCYMD
,SYSTIM
,USERID
,WSID
).BBORMHS
: Marks supplemental (DADD 03
, similar fields).
-
Deletes records as needed for supplemental and accessorial data.
-
Order History Deletion (per DC02, JB12):
- Calls
BB117
to delete line items fromBBOH
(order history table) used for duplicate order checking (perDC02
). -
Deletes only records with delete code
'D'
(perJB12
). -
Credit Limit Cross-Reference Update (BBORCL):
-
Updates
BBORCL
at level breakL1
(T L1 10N77
):- Fields:
BODEL
(delete flag),Z2
,Z92
(zero-filled fields),CRTOTL
(credit total).
- Fields:
-
Field Initialization (per LT13, JB05, JB09):
- Blank-fills or zero-fills fields in
BBORHS1
andBBORDS1
as needed (perLT13
). - Adds new tax fields to
BBORDS1
(perLT13
). - Writes new order fields from
BBORTR
toBBORDR
(perJB05
,JB09
). -
Adds miscellaneous freight amount (
BMFAMT
) to order detail (perJB14
). -
Discontinued Reporting (per JB10):
-
Stops printing the Order Update Register, as it is no longer used.
-
Cycle Completion:
- Processes all
BBORTR
records, updating files and deleting historical records. - Terminates after processing, closing all files.
- Processes all
Business Rules¶
- Order Master Update:
- Creates or updates
BBORDR
with transaction data fromBBORTR
. -
Transfers new fields:
RUSH
,OPCODE
(perDC01
),INCOTM
(perJB07
), fluid code, IMS unit of measure (IN11
, perVV04
), and detail fields likeBDQTUM
,BDPRWT
,BMFAMT
(perJB09
,JB14
). -
Customer Order Status:
- Updates
CUSORD
with status (XXSTAT
), company number (CN
), and date (YMD
). -
Marks deleted orders with
'D'
inCUSORD
. -
Supplemental and Accessorial Data:
- Manages
BBORHS1
,BBORDS1
,BBORHHS
,BBORMHS
for header/detail supplemental and accessorial data (perJB06
,JB09
,MG19
). -
Includes system metadata (
SYCYMD
,SYSTIM
,USERID
,WSID
) in supplemental files. -
Order History Deletion:
- Deletes
BBOH
records for duplicate order checking only when delete code is'D'
(perDC02
,JB12
). -
Calls
BB117
to perform deletions. -
Credit Limit Cross-Reference:
-
Updates
BBORCL
with credit totals (CRTOTL
) and zero-filled fields (Z2
,Z92
) at level breakL1
. -
Field Initialization:
- Blank-fills or zero-fills fields in
BBORHS1
andBBORDS1
(perLT13
). -
Adds new tax fields (per
LT13
) and miscellaneous freight amount (BMFAMT
, perJB14
). -
Discontinued Reporting:
-
Stops printing the Order Update Register (per
JB10
), focusing on file updates. -
No Error Handling:
-
Assumes input files contain valid data and output files can be written without issues.
-
Integration with ARGLMS:
- Part of the invoice posting workflow, ensuring order and customer data are updated accurately for inventory and financial reporting.
Tables (Files) Used¶
- BBORTR:
- Description: Order transaction file.
- Attributes: Primary input/update file (
UP
), disk-based. - Fields Used:
BOCUST
,BOSHIP
,RUSH
,OPCODE
,INCOTM
, detail fields (e.g.,BDQTUM
,BDPRWT
,BMFAMT
),IN11
. - Purpose: Contains order transactions to be processed.
-
Usage: Read to update order master and customer files.
-
BBORDR:
- Description: Order master file.
- Attributes: Update file, disk-based.
- Fields Used: Customer number, ship-to code, fluid code, IMS unit of measure, new fields (per revisions).
- Purpose: Stores order master data.
-
Usage: Created or updated with transaction data.
-
CUSORD:
- Description: Customer order file.
- Attributes: Update file (
UC
), disk-based. - Fields Used:
XXSTAT
,CN
,YMD
. - Purpose: Stores customer order status.
-
Usage: Updated with status (
'IN'
or'D'
), company, and date (E STSUPD
,E STSDEL
). -
BBORCL:
- Description: Credit limit cross-reference file.
- Attributes: Update file, disk-based.
- Fields Used:
BODEL
,Z2
,Z92
,CRTOTL
. - Purpose: Stores credit limit references.
-
Usage: Updated at level break
L1
(T L1 10N77
). -
BBORHS1:
- Description: Supplemental header file.
- Attributes: Update file, add capability (
A
), disk-based. - Fields Used:
BODTA1
,BODTA2
. - Purpose: Stores supplemental order header data.
-
Usage: Added/updated for supplemental data (
EADD
). -
BBORDS1:
- Description: Supplemental detail file.
- Attributes: Update file, add capability (
A
), disk-based. - Fields Used:
BDDTA1
,BDDTA2
, tax fields,BMFAMT
. - Purpose: Stores supplemental order detail data.
-
Usage: Added/updated for supplemental data (
EADD
). -
BBORHHS:
- Description: Additional header supplemental file.
- Attributes: Update file, add capability (
A
), disk-based. - Fields Used:
BODTA1
,BODTA2
,BOCUST
,BOSHIP
,'A'
,'Y'
,SYCYMD
,SYSTIM
,USERID
,WSID
. - Purpose: Stores additional header supplemental data.
-
Usage: Added (
DADD 01
, perMG19
). -
BBORMHS:
- Description: Marks supplemental file.
- Attributes: Update file, add capability (
A
), disk-based. - Fields Used:
BMDTA1
,BMDTA2
,BOCUST
,BOSHIP
,'A'
,'Y'
,SYCYMD
,SYSTIM
,USERID
,WSID
. - Purpose: Stores marks supplemental data.
-
Usage: Added (
DADD 03
, perMG19
). -
BBORDH:
- Description: Order header file.
- Attributes: Update file, add capability (
A
), disk-based. - Fields Used:
BDDTA1
,BDDTA2
,BOCUST
,BOSHIP
,'A'
,'Y'
,SYCYMD
,SYSTIM
,USERID
,WSID
. - Purpose: Stores order header data.
-
Usage: Added (
DADD 02
, perMG19
). -
BBOH:
- Description: Order history file.
- Attributes: Update file, disk-based.
- Purpose: Stores historical order data for duplicate checking.
- Usage: Deleted via
BB117
when delete code is'D'
(DC02
,JB12
).
External Programs Called¶
- BB117:
- Description: Program to delete line items from
BBOH
(order history table). - Purpose: Removes historical records used for duplicate order checking.
- Usage: Called to delete records with delete code
'D'
(perDC02
,JB12
).
Summary¶
The BB201
RPG program, called by the main OCL (e.g., BB600.ocl36.txt
), updates order and customer data by:
- Reading BBORTR
to process order transactions.
- Updating BBORDR
with transaction data, including new fields (RUSH
, OPCODE
, INCOTM
, IN11
, BDQTUM
, BDPRWT
, BMFAMT
).
- Updating CUSORD
with status ('IN'
or 'D'
), company number, and date.
- Managing supplemental/accessorial data in BBORHS1
, BBORDS1
, BBORHHS
, BBORMHS
, BBORDH
(per JB06
, JB09
, MG19
).
- Deleting BBOH
records via BB117
for duplicate checking (per DC02
, JB12
).
- Updating BBORCL
with credit totals.
- Initializing fields and adding tax/freight data (per LT13
, JB14
).
- Discontinuing the Order Update Register (per JB10
).
- Terminating after processing all records.
Tables Used: BBORTR
(order transactions), BBORDR
(order master), CUSORD
(customer orders), BBORCL
(credit limit cross-reference), BBORHS1
(supplemental header), BBORDS1
(supplemental detail), BBORHHS
(additional header supplemental), BBORMHS
(marks supplemental), BBORDH
(order header), BBOH
(order history).
External Programs Called: BB117
(deletes BBOH
records).
This program ensures accurate order management in the ARGLMS system by updating order data, handling supplemental information, and maintaining historical records for duplicate checking.