Skip to content

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.

  1. File Initialization:
  2. 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 (per JB02).
    • 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 (per MG11).
    • SHIPTO: Update file, contains ship-to data, subject to deletion.
    • BBTRDS, BBBLDS, BBORDS, BBOTDS: Additional files for header/detail supplemental and accessorial data (per JB09).
    • Output Files:
    • ORTRA1: Output file, likely for supplemental backorder data (per JB01).
  3. 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 (per JB09).
    • BDPRWT: Product weight (per JB09).
    • BDITLO, BDITTK, BDDTLO, BDDTTK: Location and tank codes.
    • BDTXC0BDFTC9: Additional fields (likely tax or freight codes, per LT05).
    • BA1, BA2: Supplemental header data (256 and 512 bytes, per JB01).
    • CN: Company number.
    • YMD: Date in YMD format.
  4. Record Processing (ORTRAN):

  5. Reads order transaction records from ORTRAN sequentially using the RPG cycle.
  6. Identifies invoiced orders (likely based on a status or flag, e.g., BDDATE, BDINV#).
  7. Checks for partial fulfillment to determine if backorders are needed (e.g., BDQTY vs. BDQTYS).

  8. Backorder Generation:

  9. For partially fulfilled orders (where BDQTY > BDQTYS):
    • Calculates backorder quantity (BDQTYB = BDQTY - BDQTYS).
    • Writes backorder header to ORTRHS1 (EADD ADDA, fields BA1, BA2, per JB01).
    • Writes backorder detail to ORTRDS1 (EADD ADDB, fields include BATCH#, BDINV#, BDDATE, BDLINE, BDQTY, BDQTYS, BDQTYB, BDQTUM, BDPRWT, BDITLO, BDITTK, BDDTLO, BDDTTK, BDTXC0BDFTC9).
    • Ensures detail sequence number is handled correctly for multi-load orders (per JB04, JB07, JB10).
  10. Does not include facility/batch number in backorder header (per JB01).

  11. Order Deletion:

  12. Deletes completed orders (no backorder needed) from ORTRAN (E DELBOT, sets delete flag to 'D').
  13. Deletes corresponding backorder header records from ORTRHS1 (EDEL DELBHS) and detail records from ORTRDS1 (EDEL DELBDS) for multi-load backorders not needed (per JB13).
  14. Deletes shipment address records from SHPADR (EDEL ADRDEL, per JB02) when orders are completed.
  15. Deletes records from BBORCL (EDEL UPDOCL) to remove credit limit cross-references.

  16. Customer Order Status Update:

  17. 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).
  18. Product/Container Override Reset (per MG11):

  19. 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).
  20. Field Initialization (per LT05, JB06, JB08):

  21. Blank-fills or zero-fills fields in ORTRHS1 and ORTRDS1 as needed (per LT05).
  22. Initializes new fields in order detail (per JB06).
  23. Blanks out QTCA in open order detail records (per JB08).

  24. Supplemental and Accessorial Data (per JB01, JB09):

  25. Adds/updates/deletes records in BBTRDS, BBBLDS, BBORDS, BBOTDS for header/detail supplemental and accessorial data (per JB09).
  26. Writes supplemental header data to ORTRA1 (EADD ADDA, fields BA1, BA2references to BB610 and AR211. The program ensures accurate financial reporting and inventory management within the ARGLMS system.

Business Rules

  1. Order Deletion:
  2. Deletes orders from ORTRAN that have been fully invoiced (no remaining backorder quantity).
  3. Deletes associated records from SHPADR (per JB02), ORTRHS1, ORTRDS1 (per JB13), and BBORCL when orders are completed.

  4. Backorder Generation:

  5. Creates backorders for partially fulfilled orders where ordered quantity (BDQTY) exceeds shipped quantity (BDQTYS).
  6. Calculates backorder quantity (BDQTYB = BDQTY - BDQTYS).
  7. Writes backorder header (ORTRHS1) and detail (ORTRDS1) records with detailed fields (e.g., BDINV#, BDQTYB, BDQTUM, BDPRWT).
  8. Handles multi-load orders correctly, even when detail sequence number is not 001 (per JB04, JB07, JB10).
  9. Excludes facility/batch number from backorder header (per JB01).

  10. Customer Order Status:

  11. Updates CUSORD to reflect invoiced status ('IN'), company number (CN), and current date (YMD).

  12. Shipment Address Deletion:

  13. Deletes SHPADR records for completed orders (per JB02).
  14. Deletes SHIPTO records when applicable.

  15. Product/Container Override:

  16. Resets override code to blank in PRCNTR for records with 'A' (accepted override) and updates with posting date (per MG11).

  17. Field Initialization:

  18. Blank-fills or zero-fills fields in ORTRHS1 and ORTRDS1 (per LT05).
  19. Initializes new order detail fields (per JB06).
  20. Blanks out QTCA in open order details (per JB08).

  21. Supplemental and Accessorial Data:

  22. Manages supplemental and accessorial data in BBTRDS, BBBLDS, BBORDS, BBOTDS (per JB09).
  23. Writes supplemental header data to ORTRA1 (per JB01).

  24. Multi-Load Backorder Handling:

  25. Correctly processes backorders for multi-load orders, addressing issues with non-001 sequence numbers (per JB04, JB07, JB10).

  26. No Error Handling:

  27. Assumes input files contain valid data and output files can be written without issues.

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

  1. ORTRAN:
  2. Description: Order transaction file.
  3. Attributes: Primary input/update file (UP), disk-based.
  4. Fields Used: BATCH#, BDINV#, BDDATE, BDLINE, BDQTY, BDQTYS, BDQTYB, others (not fully specified due to truncation).
  5. Purpose: Contains order transactions to be processed.
  6. Usage: Read to identify invoiced orders, deleted for completed orders (E DELBOT).

  7. CUSORD:

  8. Description: Customer order file.
  9. Attributes: Update file (UC), disk-based.
  10. Fields Used: Status ('IN'), CN (company number), YMD (date).
  11. Purpose: Stores customer order data.
  12. Usage: Updated with invoiced status and dates (E UPDSTS).

  13. SHPADR:

  14. Description: Shipment address file.
  15. Attributes: Update file, disk-based.
  16. Purpose: Stores shipment address records.
  17. Usage: Deleted for completed orders (EDEL ADRDEL, per JB02).

  18. ORTRHS1:

  19. Description: Backorder header file.
  20. Attributes: Update file, add/delete capability (A), disk-based.
  21. Fields Used: BA1 (1–256), BA2 (257–512).
  22. Purpose: Stores backorder header records.
  23. Usage: Written for backorders (EADD ADDA), deleted for unneeded multi-load backorders (EDEL DELBHS).

  24. ORTRDS1:

  25. Description: Backorder detail file.
  26. Attributes: Update file, add/delete capability (A), disk-based.
  27. Fields Used: BATCH#, BDINV#, BDDATE, BDLINE, BDQTY, BDQTYS, BDQTYB, BDQTUM, BDPRWT, BDITLO, BDITTK, BDDTLO, BDDTTK, BDTXC0BDFTC9.
  28. Purpose: Stores backorder detail records.
  29. Usage: Written for backorders (EADD ADDB), deleted for unneeded multi-load backorders (EDEL DELBDS).

  30. BBORCL:

  31. Description: Credit limit cross-reference file.
  32. Attributes: Update file, disk-based.
  33. Purpose: Stores credit limit references.
  34. Usage: Deleted for completed orders (EDEL UPDOCL).

  35. PRCNTR:

  36. Description: Product/container file.
  37. Attributes: Update file, disk-based.
  38. Fields Used: Override code, CN, YMD.
  39. Purpose: Stores product/container data.
  40. Usage: Updated to reset override codes and posting date (E UPDOVR, per MG11).

  41. SHIPTO:

  42. Description: Ship-to file.
  43. Attributes: Update file, disk-based.
  44. Purpose: Stores ship-to data.
  45. Usage: Deleted for completed orders (E UPDSHP).

  46. ORTRA1:

  47. Description: Supplemental backorder header file.
  48. Attributes: Output file, add capability (A), disk-based.
  49. Fields Used: BA1, BA2.
  50. Purpose: Stores supplemental backorder header data.
  51. Usage: Written for backorders (EADD ADDA, per JB01).

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