BB503N RPG
The BB503N.rpg.txt
is an RPG program (likely RPG III or RPG/36, given the System/36 context) called from the BB502.ocl36.txt
OCL program. It is designed to create and populate files (BBFPORH
, BBFPORD
, BBFPORA
, BBFPORF
) for shipment weight entry, specifically for SCO (Supply Chain Operations) processing, and to handle freight processor logic for internal and external processors. Below, I’ll explain the process steps, business rules, tables used, and external programs called based on the provided RPG source code.
Process Steps of the RPG Program¶
The BB503N
program processes order and shipment data to generate records in the BBFPORx
files, which are used for SCO processing. It handles order headers, details, freight calculations, and address validations, and calls external PC programs based on whether the freight processor is internal or external. Here’s a step-by-step breakdown of the process:
- Program Initialization:
- The program defines input files (
BBORDR
,SHIPTO
,ARCUST
,BBORH1
,BBORD1
,BBORA1
,BBSHPH
,BBSHPD
,BBFRPR
,SHPADR
,BBORF
) and output files (BBFPORH
,BBFPORD
,BBFPORA
,BBFPORF
) for data processing. - It uses a comment table (
COM
) to store command strings for calling external PC programs (e.g.,SCOXML.EXE
,InsertARGLMSOrder.EXE
). -
Input specifications (
I
) map fields from input files to program variables, including order header fields (e.g.,BOCO
,BORDNO
,BOCUST
,BOFRCD
) and detail fields (e.g.,BDPROD
,BDQTY
,BDUM
). -
Read Order Header (
BBORDR
and Related Files): - The program reads the
BBORDR
file (order master) to retrieve header data for a given company (BOCO
) and order number (BORDNO
). - It chains to
BBORH1
,BBORA1
, andBBSHPH
to gather additional header information, such as freight processor code (BOFPCD
), shipping reference number (SRN#
), and ship date (SHSHDT
). -
Customer and ship-to data are retrieved from
ARCUST
andSHIPTO
for address fields (ARNAME
,SNAM
,SAD1
, etc.). -
Freight Processor Validation (
BBFRPR
andSHPADR
): - The program checks the freight processor code (
BOFPCD
) in theBBFRPR
file to determine if the processor is internal or external (JB08). - For internal processors, it populates
BBFPORx
files and does not use the freight processor’s address as the freight bill address. -
For external processors, it uses the freight processor’s address (
@FBNM
,@FBA1
, etc.) fromSHPADR
as the freight bill address and populatesBBFPORx
files. -
Order Detail Processing (
BBORDD
andBBSHPD
): - The program reads
BBORDD
(order detail) andBBSHPD
(shipment detail) to process line items, retrieving fields like product (BDPROD
), quantity (BDQTY
), unit of measure (BDUM
), and weights (SDTARE
,SDGRVW
,SDACTW
). -
It converts container quantities to unit of measure quantities, pounds, and net gallons (JB01), storing results in fields like
BDCTQT
,FDQTY
,FDWT
, andFDWTUM
. -
Populate Output Files:
- BBFPORH (Header):
- Writes header data, including company (
BOCO
), order number (BORDNO
), customer (BOCUST
), ship-to (BOSHIP
), freight code (BOFRCD
), and address fields (ARNAME
,SNAM
,@FBNM
, etc.). - Includes fields like
BORUSH
andBOORPR
(DC02) and calculated totals (BOPRTO
,BOMITO
,BOFRTO
,BOORTO
).
- Writes header data, including company (
- BBFPORD (Detail):
- Writes detail data, including item details (
BDITEM
), quantities (BDQTY
,BDCTQT
,BDSQTY
), weights (SDTARE
,SDGRVW
,SDACTW
), and pricing (BDPRCE
,BDJPRC
). - Includes hazardous material fields (
BDHAZM
,BDHZD1–4
) and freight-related fields (BDFRRT
,BDJFRT
).
- Writes detail data, including item details (
- BBFPORA (Accessorial):
- Writes accessorial charges (
BAAAMT
,BAAACS
,BATCST
) to reflect additional costs (JB02).
- Writes accessorial charges (
-
BBFPORF (Freight):
- Copies freight data from
BBORF
(e.g.,BFREC1
,BFREC2
,BFTGAL
,BFGGAL
) toBBFPORF
(MG10, JB11). - Includes fields like total gross gallons (
BFGGAL
, JB11) and freight-specific calculations (BFTWGT
,BFTQTY
).
- Copies freight data from
-
Update Delivery Times:
-
If delivery times (
BODLTM
) are zero, the program updates them to a default value (JB03). -
Call External PC Programs:
- Based on the freight processor type (JB08):
- Internal: Calls
InsertARGLMSOrder.EXE
(production or test version, depending on the server, JB14). - External: Calls
SCOXML.EXE
(production or test version).
- Internal: Calls
-
The program uses the
STRPCCMD
command with strings from theCOM
table to execute these programs (e.g.,\\BRADFORD15\ARGLMS\PROD\InsertARGLMSOrder.EXE
for internal processors). -
Error Handling and Output:
- The program writes to output files only if validations pass (e.g., valid freight processor, correct address data).
- It ensures no null data issues by including fields like
BDSQTY
(MG12, MG13) and handles freight processor addresses correctly (JB08).
Business Rules¶
The program enforces several business rules, as inferred from the code and change history:
- Freight Processor Handling (JB08):
- Internal Freight Processor:
- Populate
BBFPORx
files and callInsertARGLMSOrder.EXE
. - Do not use the freight processor’s address as the freight bill address.
- Populate
- External Freight Processor:
- Populate
BBFPORx
files and callSCOXML.EXE
. - Use the freight processor’s address (
@FBNM
,@FBA1
, etc.) fromSHPADR
as the freight bill address.
- Populate
-
The freight processor status (
BOFPST
) and code (BOFPCD
) inBBFRPR
determine the processing path. -
Quantity and Weight Conversion (JB01):
- Order container quantities (
BDQTY
) must be converted to unit of measure quantities (BDCTQT
), pounds (FDWT
), and net gallons (FDNGAL
,BDNGAL
) for accurate shipment processing. -
Total gross gallons (
BFGGAL
) are copied fromBBORF
toBBFPORF
(JB11). -
Accessorial Charges (JB02):
-
Accessorial total costs (
BATCST
) must be written to theBBFPORA
table to ensure accurate billing. -
Delivery Time Updates (JB03):
-
If delivery times (
BODLTM
) are zero, they are updated to a default value to ensure valid scheduling. -
Null Data Prevention (MG12, MG13):
-
Fields like
BDSQTY
are included in output files to avoid null data issues in downstream processing. -
Customer-Owned Product and Grouping (JB05):
- The program supports customer-owned products (
BOCOON
) and grouping by specific criteria (BOGPBY
). -
Responsible area (
BORACD
) and major location (BOMLCD
) are included in the output for tracking. -
Rush and Order Process Code (DC02):
-
Rush orders (
BORUSH
) and order process status codes (BOORPR
) fromBBORDR
are copied toBBFPORH
for prioritization and tracking. -
Hazardous Materials and Freight:
- Hazardous material fields (
BDHAZM
,BDHZD1–4
) are included inBBFPORD
to comply with shipping regulations. -
Freight-related fields (
BDFRRT
,BDJFRT
,BDFRGL
) are populated for accurate freight calculations. -
Server Path Updates (JB14):
-
The program uses updated server paths for calling external programs (e.g.,
\\B-P-APP1\APPLICATIONS\ARGLMS\PROD\InsertARGLMSOrder.EXE
) to reflect changes in the application server. -
Address and Customer Data (DC01):
- The
BBSHSP
table was replaced bySHIPTO
for ship-to address data, ensuring consistency in address retrieval.
- The
-
Cross-Reference Product Expansion (MG15):
- The cross-reference product field (
BDPRXR
) was expanded to 20 characters to accommodate larger product codes.
- The cross-reference product field (
Tables (Files) Used¶
The program interacts with the following files, as defined in the F
(File) specifications:
- Input Files:
- BBORDR: Order master file (512 bytes, indexed, read-only). Contains order header data (e.g.,
BOCO
,BORDNO
,BOCUST
,BOFRCD
). - SHIPTO: Ship-to address file (2048 bytes, indexed, read-only). Contains ship-to details (e.g.,
SNAM
,SAD1
,CSCTST
,CSCSZP
). - ARCUST: Customer master file (384 bytes, indexed, read-only). Contains customer details (e.g.,
ARNAME
,ARADR1
). - BBORH1: Order header extension file (512 bytes, indexed, read-only, JB06).
- BBORD1: Order detail extension file (512 bytes, indexed, read-only, JB06).
- BBORA1: Order auxiliary file (512 bytes, indexed, read-only, JB06).
- BBSHPH: Shipment header file (128 bytes, indexed, read-only). Contains shipment header data (e.g.,
SHCAID
,SHSHDT
). - BBSHPD: Shipment detail file (256 bytes, indexed, read-only). Contains shipment detail data (e.g.,
SDTARE
,SDGRVW
,SDACTW
). - BBFRPR: Freight processor file (256 bytes, indexed, read-only). Contains freight processor details (e.g.,
BOFPCD
). - SHPADR: Shipping address file (448 bytes, indexed, read-only, JB08). Contains freight processor address data (e.g.,
@FBNM
,@FBA1
). -
BBORF: Order freight file (640 bytes, indexed, read-only, MG10). Contains freight-specific data (e.g.,
BFGGAL
,BFTWGT
). -
Output Files:
- BBFPORH: SCO order header file (2176 bytes, indexed, add-only). Stores header data for SCO processing.
- BBFPORD: SCO order detail file (768 bytes, indexed, add-only). Stores line item data.
- BBFPORA: SCO accessorial file (256 bytes, indexed, add-only). Stores accessorial charges.
- BBFPORF: SCO freight file (640 bytes, indexed, add-only, MG10). Stores freight-related data.
External Programs Called¶
The program calls external PC programs via the STRPCCMD
command, using paths defined in the COM
table:
- SCOXML.EXE (External Freight Processor, JB08):
- Production:
\\BRADFORD15\SCOPRODBIN$\SCOXML.EXE
- Test:
\\BRADFORD15\SCOTESTBIN$\SCOXML.EXE
-
Used to process orders for external freight processors, integrating with SCO systems.
-
InsertARGLMSOrder.EXE (Internal Freight Processor, JB08, JB14):
- Production (pre-JB14):
\\BRADFORD15\ARGLMS\PROD\InsertARGLMSOrder.EXE
- Test (pre-JB14):
\\BRADFORD15\ARGLMS\TEST\InsertARGLMSOrder.EXE
- Production (post-JB14):
\\B-P-APP1\APPLICATIONS\ARGLMS\PROD\InsertARGLMSOrder.EXE
- Test (post-JB14):
\\B-P-APP1\APPLICATIONS\ARGLMS\TEST\InsertARGLMSOrder.EXE
- Used to process orders for internal freight processors, integrating with the ARG LMS system.
Summary¶
The BB503N
RPG program, called from the BB502
OCL program, creates and populates BBFPORx
files for SCO processing during shipment weight entry. It processes order headers and details, converts quantities and weights, handles freight processor logic (internal vs. external), and calls external PC programs (SCOXML.EXE
or InsertARGLMSOrder.EXE
) based on the processor type. The program enforces business rules around freight processing, quantity conversions, accessorial charges, and address validation, using 11 input and 4 output files. It ensures accurate data transfer and integration with external systems for both internal and external freight processors.
If you need further details on specific logic, validations, or related content (e.g., analysis of X posts or web searches), let me know!