Skip to content

AR200 RPG36

The AR200.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 process accounts receivable (A/R) transactions from the ARTRAN file, update the customer master (ARCUST) and detail (ARDETL) files, generate history records (ARHIST), create distribution records (ARDIST), and print a Transaction Posting Register using two printer files (REPORT and REPORTP). The program handles inter-company customers differently, producing only journal entries for them without updating A/R files. It also converts dates to YMD format and supports paperless report creation (per 8/06/14 revision). Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.


Process Steps of the AR200 RPG Program

The AR200 program processes A/R transactions, updates customer and detail records, generates history and distribution records, and produces a printed Transaction Posting Register. It uses the RPG cycle to process records and includes logic for totals, aging calculations, and inter-company handling.

  1. File Initialization:
  2. The program opens the following files:
    • Input/Update Files:
    • ARTRAN: Primary input file (UP), 2560 bytes per record, disk-based. Contains A/R transactions.
    • ARDETL: Update file (UC), 128 bytes, 18-byte alternate index, add capability (A), disk-based. Stores A/R detail records.
    • ARCUST: Update file (UC), 384 bytes, 8-byte alternate index, add capability (A), disk-based. Stores customer master data.
    • ARCONT: Update file (UC), 256 bytes, 2-byte alternate index, disk-based. Contains A/R control data.
    • Output Files:
    • ARHIST: Output file (O), 128 bytes, add capability (A), disk-based. Stores A/R history records.
    • ARDIST: Output file (O), 161 bytes, disk-based. Stores distribution records (e.g., for general ledger).
    • REPORT: Printer file (O), 164 bytes, overflow indicator (OF). Used for printing the Transaction Posting Register in Bradford.
    • REPORTP: Printer file (O), 164 bytes, overflow indicator (OA). Used for paperless report creation (per 8/06/14).
  3. Defines arrays:

    • AGE: 5 elements, 9 digits, 2 decimals, for aged customer balances.
    • MN: 12 elements, 9 bytes, containing month names (January–December).
  4. Record Processing (ARTRAN):

  5. Reads each record from ARTRAN sequentially using the RPG cycle (NS 01).
  6. Key fields extracted:
    • ATCO (7–8): Company number (level 3, L3).
    • ATCUST (9–14): Customer number.
    • ATCOCU (7–14): Combined company and customer number.
    • ATINV# (15–21): Invoice number.
    • ATINV3 (15–17): Invoice number prefix.
    • ATINV1 (15–15): Invoice number first character.
  7. Processes transactions to update files and generate reports based on customer type (inter-company or regular).

  8. Customer Type Check (Inter-Company Handling):

  9. Checks if the customer is an inter-company customer (criteria not specified in snippet, likely based on ATCUST or a flag).
  10. For inter-company customers:
    • Skips updates to ARCUST, ARDETL, and ARHIST.
    • Generates journal entries in ARDIST for accounting purposes.
  11. For regular customers:

    • Updates ARCUST, ARDETL, and ARHIST.
    • Generates journal entries in ARDIST.
  12. Update Customer and Detail Files:

  13. ARCUST:
    • Updates customer master records with transaction data (e.g., balance, aging).
    • Chains using ATCOCU (company + customer number) to locate records.
  14. ARDETL:
    • Adds or updates A/R detail records with transaction details (e.g., invoice number, amount).
    • Chains using an 18-byte alternate index (likely includes ATCO, ATCUST, ATINV#).
  15. Calculates aged balances using the AGE array for customer aging (e.g., current, 30, 60, 90, 120+ days).

  16. Generate History and Distribution Records:

  17. ARHIST:
    • Writes history records (128 bytes) to ARHIST for non-inter-company customers, capturing transaction history.
  18. ARDIST:

    • Writes distribution records (161 bytes) to ARDIST for all customers, including journal entries for inter-company customers.
    • Likely includes fields for general ledger accounts, amounts, and transaction types.
  19. Date Conversion:

  20. Converts detail and history dates to YMD (Year-Month-Day) format for consistency in ARDETL and ARHIST.

  21. Print Transaction Posting Register:

  22. Outputs a Transaction Posting Register to REPORT (Bradford printing) and REPORTP (paperless report, per 8/06/14).
  23. Report includes:
    • Transaction details: Company (ATCO), customer (ATCUST), invoice number (ATINV#).
    • Totals: Total invoices (TOTINVZ), total receivables (TOTREC), total miscellaneous (TOTMIS), total discounts (TOTDIS), total cash (TOTCAS), total A/R (TOTARC), net change to A/R (NETCHG).
    • Journal types (JRNTYP) and A/R number (AR#).
    • Formatting with headers, lines, and separators (e.g., * * *, ****).
  24. Removed printing for W. Conshohocken (per 8/06/14).

  25. Cycle Completion:

  26. Processes all ARTRAN records, updating files and printing reports.
  27. Outputs totals at level breaks (L1, company level) for invoices, receivables, miscellaneous, discounts, cash, and A/R.
  28. Terminates after processing, closing all files.

Business Rules

  1. Inter-Company Customers:
  2. Do not update ARCUST, ARDETL, or ARHIST.
  3. Generate journal entries in ARDIST for accounting integration.

  4. Regular Customers:

  5. Update ARCUST with customer balance and aging information.
  6. Update or add ARDETL records with transaction details.
  7. Write ARHIST records for transaction history.
  8. Generate journal entries in ARDIST.

  9. Date Conversion:

  10. Converts all dates in ARDETL and ARHIST to YMD format for consistency.

  11. Aging Calculations:

  12. Uses the AGE array to calculate aged customer balances (e.g., current, 30, 60, 90, 120+ days) based on transaction dates.

  13. Transaction Posting Register:

  14. Prints a detailed report with transaction and total information.
  15. Supports paperless report creation via REPORTP (per 8/06/14).
  16. Includes company-level totals (L1) for invoices, receivables, miscellaneous, discounts, cash, and A/R net change.
  17. Removed W. Conshohocken printing (per 8/06/14).

  18. Description Handling (per 4/20/05):

  19. Preserves the entire 25-character description field from cash receipts in ARDETL.
  20. Moves the date to the beginning of the second description field in TEMGEN (temporary journal entry file, not listed in files but implied).

  21. No Error Handling:

  22. Assumes input files (ARTRAN, ARCUST, ARDETL, ARCONT) exist and contain valid data.
  23. Assumes output files (ARHIST, ARDIST, REPORT, REPORTP) can be written without issues.

  24. Integration with A/R Workflow:

  25. Part of the invoice posting workflow, processing A/R transactions to update customer records and generate financial reports.

Tables (Files) Used

  1. ARTRAN:
  2. Description: Accounts receivable transaction file.
  3. Attributes: 2560 bytes per record, primary input/update file (UP), disk-based.
  4. Fields Used:
    • ATCO (7–8): Company number.
    • ATCUST (9–14): Customer number.
    • ATCOCU (7–14): Combined company and customer number.
    • ATINV# (15–21): Invoice number.
    • ATINV3 (15–17): Invoice number prefix.
    • ATINV1 (15–15): Invoice number first character.
  5. Purpose: Contains A/R transactions to be processed.
  6. Usage: Read sequentially, updated as needed.

  7. ARDETL:

  8. Description: Accounts receivable detail file.
  9. Attributes: 128 bytes per record, update file (UC), 18-byte alternate index, add capability (A), disk-based.
  10. Purpose: Stores detailed A/R transaction records.
  11. Usage: Updated or added with transaction details.

  12. ARCUST:

  13. Description: Customer master file.
  14. Attributes: 384 bytes per record, update file (UC), 8-byte alternate index, add capability (A), disk-based.
  15. Purpose: Stores customer master data (e.g., balances, aging).
  16. Usage: Updated with customer balance and aging information.

  17. ARCONT:

  18. Description: Accounts receivable control file.
  19. Attributes: 256 bytes per record, update file (UC), 2-byte alternate index, disk-based.
  20. Purpose: Contains control data for A/R processing.
  21. Usage: Referenced for control information.

  22. ARHIST:

  23. Description: Accounts receivable history file.
  24. Attributes: 128 bytes per record, output file (O), add capability (A), disk-based.
  25. Purpose: Stores A/R transaction history for non-inter-company customers.
  26. Usage: Written with history records.

  27. ARDIST:

  28. Description: Accounts receivable distribution file.
  29. Attributes: 161 bytes per record, output file (O), disk-based.
  30. Purpose: Stores distribution records (e.g., journal entries for general ledger).
  31. Usage: Written for all customers, including inter-company.

  32. REPORT:

  33. Description: Transaction Posting Register printer file (Bradford).
  34. Attributes: 164 bytes per record, printer file (O), overflow indicator (OF).
  35. Fields Used:
    • TOTINVZ: Total invoices.
    • TOTREC: Total receivables.
    • TOTMIS: Total miscellaneous.
    • TOTDIS: Total discounts.
    • TOTCAS: Total cash.
    • TOTARC: Total A/R.
    • NETCHG: Net change to A/R.
    • JRNTYP: Journal type.
    • AR#: A/R number.
  36. Purpose: Prints the Transaction Posting Register.
  37. Usage: Written with report details and totals.

  38. REPORTP:

  39. Description: Transaction Posting Register printer file (paperless).
  40. Attributes: 164 bytes per record, printer file (O), overflow indicator (OA).
  41. Fields Used: Same as REPORT.
  42. Purpose: Creates paperless version of the Transaction Posting Register.
  43. Usage: Written with report details and totals (per 8/06/14).

External Programs Called

The AR200 RPG program does not explicitly call any external programs. It is a self-contained program that processes input from ARTRAN and supporting files, updates files, and generates reports.


Summary

The AR200 RPG program, called by the main OCL (e.g., BB600.ocl36.txt), processes A/R transactions by: - Reading ARTRAN records and checking for inter-company customers. - Updating ARCUST and ARDETL for non-inter-company customers, writing ARHIST records. - Generating ARDIST journal entries for all customers. - Converting dates to YMD format for ARDETL and ARHIST. - Printing a Transaction Posting Register to REPORT (Bradford) and REPORTP (paperless, per 8/06/14). - Calculating totals (TOTINVZ, TOTREC, TOTMIS, TOTDIS, TOTCAS, TOTARC, NETCHG) at company level (L1). - Terminating after processing all records.

Tables Used: ARTRAN (A/R transactions), ARDETL (A/R details), ARCUST (customer master), ARCONT (A/R control), ARHIST (A/R history), ARDIST (distribution), REPORT (printer), REPORTP (paperless printer). External Programs Called: None.

This program supports the A/R module of the invoice posting workflow by updating customer records, generating history and journal entries, and producing a detailed register for reporting.