Skip to content

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:

  1. Program Initialization:
  2. 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.
  3. It uses a comment table (COM) to store command strings for calling external PC programs (e.g., SCOXML.EXE, InsertARGLMSOrder.EXE).
  4. 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).

  5. Read Order Header (BBORDR and Related Files):

  6. The program reads the BBORDR file (order master) to retrieve header data for a given company (BOCO) and order number (BORDNO).
  7. It chains to BBORH1, BBORA1, and BBSHPH to gather additional header information, such as freight processor code (BOFPCD), shipping reference number (SRN#), and ship date (SHSHDT).
  8. Customer and ship-to data are retrieved from ARCUST and SHIPTO for address fields (ARNAME, SNAM, SAD1, etc.).

  9. Freight Processor Validation (BBFRPR and SHPADR):

  10. The program checks the freight processor code (BOFPCD) in the BBFRPR file to determine if the processor is internal or external (JB08).
  11. For internal processors, it populates BBFPORx files and does not use the freight processor’s address as the freight bill address.
  12. For external processors, it uses the freight processor’s address (@FBNM, @FBA1, etc.) from SHPADR as the freight bill address and populates BBFPORx files.

  13. Order Detail Processing (BBORDD and BBSHPD):

  14. The program reads BBORDD (order detail) and BBSHPD (shipment detail) to process line items, retrieving fields like product (BDPROD), quantity (BDQTY), unit of measure (BDUM), and weights (SDTARE, SDGRVW, SDACTW).
  15. It converts container quantities to unit of measure quantities, pounds, and net gallons (JB01), storing results in fields like BDCTQT, FDQTY, FDWT, and FDWTUM.

  16. Populate Output Files:

  17. 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 and BOORPR (DC02) and calculated totals (BOPRTO, BOMITO, BOFRTO, BOORTO).
  18. 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).
  19. BBFPORA (Accessorial):
    • Writes accessorial charges (BAAAMT, BAAACS, BATCST) to reflect additional costs (JB02).
  20. BBFPORF (Freight):

    • Copies freight data from BBORF (e.g., BFREC1, BFREC2, BFTGAL, BFGGAL) to BBFPORF (MG10, JB11).
    • Includes fields like total gross gallons (BFGGAL, JB11) and freight-specific calculations (BFTWGT, BFTQTY).
  21. Update Delivery Times:

  22. If delivery times (BODLTM) are zero, the program updates them to a default value (JB03).

  23. Call External PC Programs:

  24. 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).
  25. The program uses the STRPCCMD command with strings from the COM table to execute these programs (e.g., \\BRADFORD15\ARGLMS\PROD\InsertARGLMSOrder.EXE for internal processors).

  26. Error Handling and Output:

  27. The program writes to output files only if validations pass (e.g., valid freight processor, correct address data).
  28. 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:

  1. Freight Processor Handling (JB08):
  2. Internal Freight Processor:
    • Populate BBFPORx files and call InsertARGLMSOrder.EXE.
    • Do not use the freight processor’s address as the freight bill address.
  3. External Freight Processor:
    • Populate BBFPORx files and call SCOXML.EXE.
    • Use the freight processor’s address (@FBNM, @FBA1, etc.) from SHPADR as the freight bill address.
  4. The freight processor status (BOFPST) and code (BOFPCD) in BBFRPR determine the processing path.

  5. Quantity and Weight Conversion (JB01):

  6. Order container quantities (BDQTY) must be converted to unit of measure quantities (BDCTQT), pounds (FDWT), and net gallons (FDNGAL, BDNGAL) for accurate shipment processing.
  7. Total gross gallons (BFGGAL) are copied from BBORF to BBFPORF (JB11).

  8. Accessorial Charges (JB02):

  9. Accessorial total costs (BATCST) must be written to the BBFPORA table to ensure accurate billing.

  10. Delivery Time Updates (JB03):

  11. If delivery times (BODLTM) are zero, they are updated to a default value to ensure valid scheduling.

  12. Null Data Prevention (MG12, MG13):

  13. Fields like BDSQTY are included in output files to avoid null data issues in downstream processing.

  14. Customer-Owned Product and Grouping (JB05):

  15. The program supports customer-owned products (BOCOON) and grouping by specific criteria (BOGPBY).
  16. Responsible area (BORACD) and major location (BOMLCD) are included in the output for tracking.

  17. Rush and Order Process Code (DC02):

  18. Rush orders (BORUSH) and order process status codes (BOORPR) from BBORDR are copied to BBFPORH for prioritization and tracking.

  19. Hazardous Materials and Freight:

  20. Hazardous material fields (BDHAZM, BDHZD1–4) are included in BBFPORD to comply with shipping regulations.
  21. Freight-related fields (BDFRRT, BDJFRT, BDFRGL) are populated for accurate freight calculations.

  22. Server Path Updates (JB14):

  23. 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.

  24. Address and Customer Data (DC01):

    • The BBSHSP table was replaced by SHIPTO for ship-to address data, ensuring consistency in address retrieval.
  25. Cross-Reference Product Expansion (MG15):

    • The cross-reference product field (BDPRXR) was expanded to 20 characters to accommodate larger product codes.

Tables (Files) Used

The program interacts with the following files, as defined in the F (File) specifications:

  1. Input Files:
  2. BBORDR: Order master file (512 bytes, indexed, read-only). Contains order header data (e.g., BOCO, BORDNO, BOCUST, BOFRCD).
  3. SHIPTO: Ship-to address file (2048 bytes, indexed, read-only). Contains ship-to details (e.g., SNAM, SAD1, CSCTST, CSCSZP).
  4. ARCUST: Customer master file (384 bytes, indexed, read-only). Contains customer details (e.g., ARNAME, ARADR1).
  5. BBORH1: Order header extension file (512 bytes, indexed, read-only, JB06).
  6. BBORD1: Order detail extension file (512 bytes, indexed, read-only, JB06).
  7. BBORA1: Order auxiliary file (512 bytes, indexed, read-only, JB06).
  8. BBSHPH: Shipment header file (128 bytes, indexed, read-only). Contains shipment header data (e.g., SHCAID, SHSHDT).
  9. BBSHPD: Shipment detail file (256 bytes, indexed, read-only). Contains shipment detail data (e.g., SDTARE, SDGRVW, SDACTW).
  10. BBFRPR: Freight processor file (256 bytes, indexed, read-only). Contains freight processor details (e.g., BOFPCD).
  11. SHPADR: Shipping address file (448 bytes, indexed, read-only, JB08). Contains freight processor address data (e.g., @FBNM, @FBA1).
  12. BBORF: Order freight file (640 bytes, indexed, read-only, MG10). Contains freight-specific data (e.g., BFGGAL, BFTWGT).

  13. Output Files:

  14. BBFPORH: SCO order header file (2176 bytes, indexed, add-only). Stores header data for SCO processing.
  15. BBFPORD: SCO order detail file (768 bytes, indexed, add-only). Stores line item data.
  16. BBFPORA: SCO accessorial file (256 bytes, indexed, add-only). Stores accessorial charges.
  17. 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:

  1. SCOXML.EXE (External Freight Processor, JB08):
  2. Production: \\BRADFORD15\SCOPRODBIN$\SCOXML.EXE
  3. Test: \\BRADFORD15\SCOTESTBIN$\SCOXML.EXE
  4. Used to process orders for external freight processors, integrating with SCO systems.

  5. InsertARGLMSOrder.EXE (Internal Freight Processor, JB08, JB14):

  6. Production (pre-JB14): \\BRADFORD15\ARGLMS\PROD\InsertARGLMSOrder.EXE
  7. Test (pre-JB14): \\BRADFORD15\ARGLMS\TEST\InsertARGLMSOrder.EXE
  8. Production (post-JB14): \\B-P-APP1\APPLICATIONS\ARGLMS\PROD\InsertARGLMSOrder.EXE
  9. Test (post-JB14): \\B-P-APP1\APPLICATIONS\ARGLMS\TEST\InsertARGLMSOrder.EXE
  10. 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!