Skip to content

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.

  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:
    • 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, per MG19).
    • BBORHHS: Update file, additional header supplemental file (per MG19).
    • BBORMHS: Update file, marks supplemental file (per MG19).
    • BBOH: Order history file, used for duplicate order checking, subject to deletion (per DC02, JB12).
    • Output Files:
    • None explicitly for printing, as the Order Update Register was discontinued (per JB10).
  3. 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 (per JB09).
    • IN11: Fluid code or IMS unit of measure (per VV04).
    • RUSH, OPCODE: Rush order and order process code (per DC01).
    • INCOTM: Incoterms code (per JB07).
    • BMFAMT: Miscellaneous freight amount (per JB14).
  4. Record Processing (BBORTR):

  5. Reads order transaction records from BBORTR sequentially using the RPG cycle.
  6. Processes transactions to update order master (BBORDR) and customer order (CUSORD) files.
  7. Identifies new or existing orders for updates or deletions.

  8. Order Master Update (BBORDR):

  9. Creates or updates BBORDR with transaction data from BBORTR.
  10. Transfers fields such as customer number (BOCUST), ship-to code (BOSHIP), and new fields like RUSH, OPCODE (per DC01), INCOTM (per JB07), and detail fields (per JB09, e.g., BDQTUM, BDPRWT, BMFAMT).
  11. Updates order detail with fluid code and IMS unit of measure (IN11, per VV04).

  12. Customer Order Status Update (CUSORD):

  13. Updates CUSORD (E STSUPD or E 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).
  14. Supplemental and Accessorial Data (per JB06, JB09, MG19):

  15. Adds or updates records in:
    • BBORHS1: Supplemental header (EADD, fields BODTA1, BODTA2).
    • BBORDS1: Supplemental detail (EADD, fields BDDTA1, BDDTA2).
    • BBORHHS: Additional header supplemental (DADD 01, fields BODTA1, BODTA2, BOCUST, BOSHIP, 'A', 'Y', SYCYMD, SYSTIM, USERID, WSID).
    • BBORMHS: Marks supplemental (DADD 03, similar fields).
  16. Deletes records as needed for supplemental and accessorial data.

  17. Order History Deletion (per DC02, JB12):

  18. Calls BB117 to delete line items from BBOH (order history table) used for duplicate order checking (per DC02).
  19. Deletes only records with delete code 'D' (per JB12).

  20. Credit Limit Cross-Reference Update (BBORCL):

  21. Updates BBORCL at level break L1 (T L1 10N77):

    • Fields: BODEL (delete flag), Z2, Z92 (zero-filled fields), CRTOTL (credit total).
  22. Field Initialization (per LT13, JB05, JB09):

  23. Blank-fills or zero-fills fields in BBORHS1 and BBORDS1 as needed (per LT13).
  24. Adds new tax fields to BBORDS1 (per LT13).
  25. Writes new order fields from BBORTR to BBORDR (per JB05, JB09).
  26. Adds miscellaneous freight amount (BMFAMT) to order detail (per JB14).

  27. Discontinued Reporting (per JB10):

  28. Stops printing the Order Update Register, as it is no longer used.

  29. Cycle Completion:

    • Processes all BBORTR records, updating files and deleting historical records.
    • Terminates after processing, closing all files.

Business Rules

  1. Order Master Update:
  2. Creates or updates BBORDR with transaction data from BBORTR.
  3. Transfers new fields: RUSH, OPCODE (per DC01), INCOTM (per JB07), fluid code, IMS unit of measure (IN11, per VV04), and detail fields like BDQTUM, BDPRWT, BMFAMT (per JB09, JB14).

  4. Customer Order Status:

  5. Updates CUSORD with status (XXSTAT), company number (CN), and date (YMD).
  6. Marks deleted orders with 'D' in CUSORD.

  7. Supplemental and Accessorial Data:

  8. Manages BBORHS1, BBORDS1, BBORHHS, BBORMHS for header/detail supplemental and accessorial data (per JB06, JB09, MG19).
  9. Includes system metadata (SYCYMD, SYSTIM, USERID, WSID) in supplemental files.

  10. Order History Deletion:

  11. Deletes BBOH records for duplicate order checking only when delete code is 'D' (per DC02, JB12).
  12. Calls BB117 to perform deletions.

  13. Credit Limit Cross-Reference:

  14. Updates BBORCL with credit totals (CRTOTL) and zero-filled fields (Z2, Z92) at level break L1.

  15. Field Initialization:

  16. Blank-fills or zero-fills fields in BBORHS1 and BBORDS1 (per LT13).
  17. Adds new tax fields (per LT13) and miscellaneous freight amount (BMFAMT, per JB14).

  18. Discontinued Reporting:

  19. Stops printing the Order Update Register (per JB10), focusing on file updates.

  20. No Error Handling:

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

  22. Integration with ARGLMS:

  23. Part of the invoice posting workflow, ensuring order and customer data are updated accurately for inventory and financial reporting.

Tables (Files) Used

  1. BBORTR:
  2. Description: Order transaction file.
  3. Attributes: Primary input/update file (UP), disk-based.
  4. Fields Used: BOCUST, BOSHIP, RUSH, OPCODE, INCOTM, detail fields (e.g., BDQTUM, BDPRWT, BMFAMT), IN11.
  5. Purpose: Contains order transactions to be processed.
  6. Usage: Read to update order master and customer files.

  7. BBORDR:

  8. Description: Order master file.
  9. Attributes: Update file, disk-based.
  10. Fields Used: Customer number, ship-to code, fluid code, IMS unit of measure, new fields (per revisions).
  11. Purpose: Stores order master data.
  12. Usage: Created or updated with transaction data.

  13. CUSORD:

  14. Description: Customer order file.
  15. Attributes: Update file (UC), disk-based.
  16. Fields Used: XXSTAT, CN, YMD.
  17. Purpose: Stores customer order status.
  18. Usage: Updated with status ('IN' or 'D'), company, and date (E STSUPD, E STSDEL).

  19. BBORCL:

  20. Description: Credit limit cross-reference file.
  21. Attributes: Update file, disk-based.
  22. Fields Used: BODEL, Z2, Z92, CRTOTL.
  23. Purpose: Stores credit limit references.
  24. Usage: Updated at level break L1 (T L1 10N77).

  25. BBORHS1:

  26. Description: Supplemental header file.
  27. Attributes: Update file, add capability (A), disk-based.
  28. Fields Used: BODTA1, BODTA2.
  29. Purpose: Stores supplemental order header data.
  30. Usage: Added/updated for supplemental data (EADD).

  31. BBORDS1:

  32. Description: Supplemental detail file.
  33. Attributes: Update file, add capability (A), disk-based.
  34. Fields Used: BDDTA1, BDDTA2, tax fields, BMFAMT.
  35. Purpose: Stores supplemental order detail data.
  36. Usage: Added/updated for supplemental data (EADD).

  37. BBORHHS:

  38. Description: Additional header supplemental file.
  39. Attributes: Update file, add capability (A), disk-based.
  40. Fields Used: BODTA1, BODTA2, BOCUST, BOSHIP, 'A', 'Y', SYCYMD, SYSTIM, USERID, WSID.
  41. Purpose: Stores additional header supplemental data.
  42. Usage: Added (DADD 01, per MG19).

  43. BBORMHS:

  44. Description: Marks supplemental file.
  45. Attributes: Update file, add capability (A), disk-based.
  46. Fields Used: BMDTA1, BMDTA2, BOCUST, BOSHIP, 'A', 'Y', SYCYMD, SYSTIM, USERID, WSID.
  47. Purpose: Stores marks supplemental data.
  48. Usage: Added (DADD 03, per MG19).

  49. BBORDH:

  50. Description: Order header file.
  51. Attributes: Update file, add capability (A), disk-based.
  52. Fields Used: BDDTA1, BDDTA2, BOCUST, BOSHIP, 'A', 'Y', SYCYMD, SYSTIM, USERID, WSID.
  53. Purpose: Stores order header data.
  54. Usage: Added (DADD 02, per MG19).

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

  1. BB117:
  2. Description: Program to delete line items from BBOH (order history table).
  3. Purpose: Removes historical records used for duplicate order checking.
  4. Usage: Called to delete records with delete code 'D' (per DC02, 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.