BB610 RPG36
The BB610.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 delete orders that have been invoiced, generate backorders for partially fulfilled orders, and update related files. It handles customer order status updates, shipment address deletions, backorder processing for multi-load orders, and resets product/container override codes. The program includes multiple revisions to address specific issues, such as multi-load backorder handling and field initialization. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.
Process Steps of the BB610 RPG Program¶
The BB610
program processes invoiced orders from ORTRAN
, deletes completed orders, generates backorders in ORTRHS1
and ORTRDS1
, updates customer order status in CUSORD
, and performs related file maintenance (e.g., SHPADR
, PRCNTR
). It incorporates revisions for multi-load orders, field initialization, and override code resets.
- 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:
ORTRAN
: Primary input file (UP
), contains order transaction records.CUSORD
: Update file (UC
), stores customer order data, updated with status and dates.SHPADR
: Update file, contains shipment address records, subject to deletion (perJB02
).ORTRHS1
: Update file, stores backorder header records, supports add/delete (A
).ORTRDS1
: Update file, stores backorder detail records, supports add/delete (A
).BBORCL
: Update file, credit limit cross-reference file, subject to deletion.PRCNTR
: Update file, product/container file, updated for override codes and dates (perMG11
).SHIPTO
: Update file, contains ship-to data, subject to deletion.BBTRDS
,BBBLDS
,BBORDS
,BBOTDS
: Additional files for header/detail supplemental and accessorial data (perJB09
).- Output Files:
ORTRA1
: Output file, likely for supplemental backorder data (perJB01
).
-
Key fields (from output specifications):
BATCH#
: Batch number.BDINV#
: Invoice number.BDDATE
: Date.BDLINE
: Line number.BDQTY
: Quantity.BDQTYS
: Quantity shipped.BDQTYB
: Backorder quantity.BDQTUM
: Backorder quantity unit of measure (perJB09
).BDPRWT
: Product weight (perJB09
).BDITLO
,BDITTK
,BDDTLO
,BDDTTK
: Location and tank codes.BDTXC0
–BDFTC9
: Additional fields (likely tax or freight codes, perLT05
).BA1
,BA2
: Supplemental header data (256 and 512 bytes, perJB01
).CN
: Company number.YMD
: Date in YMD format.
-
Record Processing (ORTRAN):
- Reads order transaction records from
ORTRAN
sequentially using the RPG cycle. - Identifies invoiced orders (likely based on a status or flag, e.g.,
BDDATE
,BDINV#
). -
Checks for partial fulfillment to determine if backorders are needed (e.g.,
BDQTY
vs.BDQTYS
). -
Backorder Generation:
- For partially fulfilled orders (where
BDQTY
>BDQTYS
):- Calculates backorder quantity (
BDQTYB = BDQTY - BDQTYS
). - Writes backorder header to
ORTRHS1
(EADD ADDA
, fieldsBA1
,BA2
, perJB01
). - Writes backorder detail to
ORTRDS1
(EADD ADDB
, fields includeBATCH#
,BDINV#
,BDDATE
,BDLINE
,BDQTY
,BDQTYS
,BDQTYB
,BDQTUM
,BDPRWT
,BDITLO
,BDITTK
,BDDTLO
,BDDTTK
,BDTXC0
–BDFTC9
). - Ensures detail sequence number is handled correctly for multi-load orders (per
JB04
,JB07
,JB10
).
- Calculates backorder quantity (
-
Does not include facility/batch number in backorder header (per
JB01
). -
Order Deletion:
- Deletes completed orders (no backorder needed) from
ORTRAN
(E DELBOT
, sets delete flag to'D'
). - Deletes corresponding backorder header records from
ORTRHS1
(EDEL DELBHS
) and detail records fromORTRDS1
(EDEL DELBDS
) for multi-load backorders not needed (perJB13
). - Deletes shipment address records from
SHPADR
(EDEL ADRDEL
, perJB02
) when orders are completed. -
Deletes records from
BBORCL
(EDEL UPDOCL
) to remove credit limit cross-references. -
Customer Order Status Update:
-
Updates
CUSORD
(E UPDSTS
):- Sets status to
'IN'
(invoiced, position 17). - Updates company number (
CN
, position 19). - Updates last ship date to current date (
YMD
, position 25).
- Sets status to
-
Product/Container Override Reset (per MG11):
-
Updates
PRCNTR
(E UPDOVR
):- Resets override code to blank (position 19) for records with
'A'
(accepted override). - Updates company number (
CN
, position 12). - Updates posting date (
YMD
, position 18).
- Resets override code to blank (position 19) for records with
-
Field Initialization (per LT05, JB06, JB08):
- Blank-fills or zero-fills fields in
ORTRHS1
andORTRDS1
as needed (perLT05
). - Initializes new fields in order detail (per
JB06
). -
Blanks out
QTCA
in open order detail records (perJB08
). -
Supplemental and Accessorial Data (per JB01, JB09):
- Adds/updates/deletes records in
BBTRDS
,BBBLDS
,BBORDS
,BBOTDS
for header/detail supplemental and accessorial data (perJB09
). - Writes supplemental header data to
ORTRA1
(EADD ADDA
, fieldsBA1
,BA2
references toBB610
andAR211
. The program ensures accurate financial reporting and inventory management within the ARGLMS system.
Business Rules¶
- Order Deletion:
- Deletes orders from
ORTRAN
that have been fully invoiced (no remaining backorder quantity). -
Deletes associated records from
SHPADR
(perJB02
),ORTRHS1
,ORTRDS1
(perJB13
), andBBORCL
when orders are completed. -
Backorder Generation:
- Creates backorders for partially fulfilled orders where ordered quantity (
BDQTY
) exceeds shipped quantity (BDQTYS
). - Calculates backorder quantity (
BDQTYB = BDQTY - BDQTYS
). - Writes backorder header (
ORTRHS1
) and detail (ORTRDS1
) records with detailed fields (e.g.,BDINV#
,BDQTYB
,BDQTUM
,BDPRWT
). - Handles multi-load orders correctly, even when detail sequence number is not
001
(perJB04
,JB07
,JB10
). -
Excludes facility/batch number from backorder header (per
JB01
). -
Customer Order Status:
-
Updates
CUSORD
to reflect invoiced status ('IN'
), company number (CN
), and current date (YMD
). -
Shipment Address Deletion:
- Deletes
SHPADR
records for completed orders (perJB02
). -
Deletes
SHIPTO
records when applicable. -
Product/Container Override:
-
Resets override code to blank in
PRCNTR
for records with'A'
(accepted override) and updates with posting date (perMG11
). -
Field Initialization:
- Blank-fills or zero-fills fields in
ORTRHS1
andORTRDS1
(perLT05
). - Initializes new order detail fields (per
JB06
). -
Blanks out
QTCA
in open order details (perJB08
). -
Supplemental and Accessorial Data:
- Manages supplemental and accessorial data in
BBTRDS
,BBBLDS
,BBORDS
,BBOTDS
(perJB09
). -
Writes supplemental header data to
ORTRA1
(perJB01
). -
Multi-Load Backorder Handling:
-
Correctly processes backorders for multi-load orders, addressing issues with non-
001
sequence numbers (perJB04
,JB07
,JB10
). -
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 invoiced orders are removed, backorders are generated, and related files are updated for inventory and financial accuracy.
Tables (Files) Used¶
- ORTRAN:
- Description: Order transaction file.
- Attributes: Primary input/update file (
UP
), disk-based. - Fields Used:
BATCH#
,BDINV#
,BDDATE
,BDLINE
,BDQTY
,BDQTYS
,BDQTYB
, others (not fully specified due to truncation). - Purpose: Contains order transactions to be processed.
-
Usage: Read to identify invoiced orders, deleted for completed orders (
E DELBOT
). -
CUSORD:
- Description: Customer order file.
- Attributes: Update file (
UC
), disk-based. - Fields Used: Status (
'IN'
),CN
(company number),YMD
(date). - Purpose: Stores customer order data.
-
Usage: Updated with invoiced status and dates (
E UPDSTS
). -
SHPADR:
- Description: Shipment address file.
- Attributes: Update file, disk-based.
- Purpose: Stores shipment address records.
-
Usage: Deleted for completed orders (
EDEL ADRDEL
, perJB02
). -
ORTRHS1:
- Description: Backorder header file.
- Attributes: Update file, add/delete capability (
A
), disk-based. - Fields Used:
BA1
(1–256),BA2
(257–512). - Purpose: Stores backorder header records.
-
Usage: Written for backorders (
EADD ADDA
), deleted for unneeded multi-load backorders (EDEL DELBHS
). -
ORTRDS1:
- Description: Backorder detail file.
- Attributes: Update file, add/delete capability (
A
), disk-based. - Fields Used:
BATCH#
,BDINV#
,BDDATE
,BDLINE
,BDQTY
,BDQTYS
,BDQTYB
,BDQTUM
,BDPRWT
,BDITLO
,BDITTK
,BDDTLO
,BDDTTK
,BDTXC0
–BDFTC9
. - Purpose: Stores backorder detail records.
-
Usage: Written for backorders (
EADD ADDB
), deleted for unneeded multi-load backorders (EDEL DELBDS
). -
BBORCL:
- Description: Credit limit cross-reference file.
- Attributes: Update file, disk-based.
- Purpose: Stores credit limit references.
-
Usage: Deleted for completed orders (
EDEL UPDOCL
). -
PRCNTR:
- Description: Product/container file.
- Attributes: Update file, disk-based.
- Fields Used: Override code,
CN
,YMD
. - Purpose: Stores product/container data.
-
Usage: Updated to reset override codes and posting date (
E UPDOVR
, perMG11
). -
SHIPTO:
- Description: Ship-to file.
- Attributes: Update file, disk-based.
- Purpose: Stores ship-to data.
-
Usage: Deleted for completed orders (
E UPDSHP
). -
ORTRA1:
- Description: Supplemental backorder header file.
- Attributes: Output file, add capability (
A
), disk-based. - Fields Used:
BA1
,BA2
. - Purpose: Stores supplemental backorder header data.
-
Usage: Written for backorders (
EADD ADDA
, perJB01
). -
BBTRDS, BBBLDS, BBORDS, BBOTDS:
- Description: Supplemental and accessorial data files (header/detail).
- Attributes: Update files, disk-based (per
JB09
). - Purpose: Store additional order data (e.g., tax, freight, marks).
- Usage: Added/updated/deleted for backorder processing.
External Programs Called¶
The BB610
RPG program does not explicitly call any external programs. It is a self-contained program that processes input from ORTRAN
and other files and updates or writes to multiple output files.
Summary¶
The BB610
RPG program, called by the main OCL (e.g., BB600.ocl36.txt
), manages invoiced orders by:
- Reading ORTRAN
to identify invoiced orders and calculate backorder quantities (BDQTYB
).
- Generating backorder headers (ORTRHS1
) and details (ORTRDS1
) for partially fulfilled orders, handling multi-load cases (per JB04
, JB07
, JB10
).
- Deleting completed orders from ORTRAN
, SHPADR
(per JB02
), ORTRHS1
, ORTRDS1
(per JB13
), BBORCL
, and SHIPTO
.
- Updating CUSORD
with invoiced status ('IN'
), company number, and date.
- Resetting override codes in PRCNTR
and updating posting dates (per MG11
).
- Initializing fields (LT05
, JB06
, JB08
) and managing supplemental/accessorial data (JB01
, JB09
).
- Terminating after processing all records.
Tables Used: ORTRAN
(order transactions), CUSORD
(customer orders), SHPADR
(shipment addresses), ORTRHS1
(backorder headers), ORTRDS1
(backorder details), BBORCL
(credit limit cross-reference), PRCNTR
(product/container), SHIPTO
(ship-to data), ORTRA1
(supplemental headers), BBTRDS
, BBBLDS
, BBORDS
, BBOTDS
(supplemental/accessorial data).
External Programs Called: None.
This program ensures accurate order management in the ARGLMS system by deleting invoiced orders, generating backorders, and updating related files for inventory and financial accuracy.