Skip to content

AR210 RPG36

The AR210.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 create accounts receivable (A/R) journal entries by processing records from the ARDIST file and writing them to the ARTEMG file, which serves as a temporary file for general ledger journal entries. The program also references the ARCONT file for control data and handles the preservation of the full 25-character description field from cash receipts (per 4/20/05 revision). Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.


Process Steps of the AR210 RPG Program

The AR210 program reads distribution records from ARDIST, processes them based on transaction type (indicated by control indicators CI, CJ, CP), and generates journal entries in ARTEMG. It uses ARCONT for control information and formats entries for general ledger integration.

  1. File Initialization:
  2. The program opens the following files:
    • Input Files:
    • ARDIST: Primary input file (IPE), 161 bytes per record, disk-based. Contains A/R distribution records.
    • ARCONT: Input file (IC), 256 bytes, 2-byte alternate index, disk-based. Contains A/R control data.
    • Output File:
    • ARTEMG: Output file (O), 128 bytes, disk-based. Stores temporary journal entries for general ledger.
  3. Defines record formats for ARDIST with three condition indicators:
    • CI (01): Cash transaction.
    • CJ (02): Journal transaction.
    • CP (03): Payment or other transaction type.
  4. Key fields extracted from ARDIST:

    • ADCO (4–5): Company number.
    • ADCUST (6–11): Customer number.
    • COCUST (4–11): Combined company and customer number.
    • ADINV# (12–18): Invoice number.
    • ADAMT (19–27): Transaction amount (8 digits, 2 decimals).
    • ADDISC (29–35): Transaction discount (5 digits, 1 decimal).
    • ADGLCR (36–43): General ledger credit amount (5 digits, 2 decimals).
    • ADGLDR (44–51): General ledger debit account (5 digits, 3 decimals).
    • ADJRDT (52–57): Journal date.
    • ADCODR (58–59): Credit code.
    • ADCOCR (60–61): Credit control code.
    • ADNAME (65–84): Customer name.
    • ADCODI (85–86): Discount code.
    • ADGLDI (87–94): General ledger discount account.
    • ADJRNL (95–98): Journal number.
    • ADMISC (120–128): Miscellaneous amount (8 digits, 2 decimals).
  5. Record Processing (ARDIST):

  6. Reads each record from ARDIST sequentially using the RPG cycle (NS 01, OR 02, OR 03).
  7. Identifies the transaction type based on indicators:
    • CI (01): Cash transaction.
    • CJ (02): Journal transaction.
    • CP (03): Payment or other transaction.
  8. Chains to ARCONT using a 2-byte alternate index to retrieve control data (e.g., company-specific settings).

  9. Journal Entry Creation:

  10. Writes records to ARTEMG based on transaction type, using exception output (E) specifications at different line numbers (e.g., 31, 32, 33, 34, 35).
  11. Cash Transactions (CI, Lines 31–33):
    • Writes three types of journal entries:
    • Cash Receipt (line 31):
      • Fields: 'A' (type), ICRCO (company), ADJRNL (journal number), IC (control field), ICRGL8 (GL account), ADNAME, ADINV#, ADJRDT, CRAMT (credit amount), 'S' (status), ADDESC (description, 25 characters).
    • Cash Receipt Alternate (line 32):
      • Similar fields, with variations in GL account or amount.
    • Cash Receipt Final (line 33):
      • Similar fields, possibly for a different GL account.
  12. Journal Transactions (CJ, Line 34):
    • Writes journal entries for inter-company or other transactions:
    • Fields: 'A' (type), ICRCO (company), ADJRNL, IC, ICRGL8, ADNAME, ADINV#, ADJRDT, ICRAMT (amount), 'S', ADDESC.
  13. Payment Transactions (CP, Line 34):
    • Writes payment-related entries:
    • Fields: 'A' (type), IDRCO (company), ADJRNL, ID, IDRGL8, ADNAME, ADINV#, ADJRDT, IDRAMT, 'S', ADDESC.
  14. Discount Transactions (Line 35):

    • Writes discount entries based on indicator 82 (not defined in snippet, likely a discount flag):
    • If 82 is off: Sets field at position 12 to 'D' (debit).
    • If 82 is on: Sets field at position 12 to 'C' (credit).
    • Fields: 'A' (type), ADCODI (discount code), ADJRNL, 'D' or 'C', ADGLDI (GL discount account), ADNAME, ADINV#, ADJRDT, DISC11 (discount amount), 'S', ADDESC.
  15. Description Handling (per 4/20/05):

  16. Preserves the full 25-character description field (ADDESC) from cash receipts.
  17. Moves the date to the beginning of the second description field in ARTEMG, ensuring the first field contains the A/R description.

  18. Cycle Completion:

  19. Processes all ARDIST records, generating journal entries in ARTEMG.
  20. Terminates after processing, closing all files.

Business Rules

  1. Journal Entry Creation:
  2. Generates journal entries in ARTEMG for general ledger integration based on transaction type (CI, CJ, CP).
  3. Supports cash receipts, journal transactions, payments, and discounts.

  4. Transaction Types:

  5. Cash Transactions (CI): Creates multiple journal entries for cash receipts, likely for different GL accounts or amounts.
  6. Journal Transactions (CJ): Handles inter-company or other journal entries.
  7. Payment Transactions (CP): Processes payment-related entries.
  8. Discount Transactions: Creates debit or credit entries based on indicator 82, using DISC11 for the discount amount.

  9. Description Preservation (per 4/20/05):

  10. Retains the full 25-character description (ADDESC) from cash receipts.
  11. Places the journal date (ADJRDT) at the beginning of the second description field in ARTEMG.

  12. Control Data:

  13. Uses ARCONT to retrieve company-specific control data (e.g., ICRCO, ICRGL8) for journal entries.

  14. No Validation or Filtering:

  15. Assumes all ARDIST records are valid and suitable for journal entry creation.
  16. No explicit checks for transaction amounts, dates, or customer data.

  17. No Error Handling:

  18. Assumes input files (ARDIST, ARCONT) exist and contain valid data, and ARTEMG can be written without issues.

  19. Integration with A/R Workflow:

  20. Part of the invoice posting workflow, creating journal entries for A/R transactions to integrate with the general ledger.

Tables (Files) Used

  1. ARDIST:
  2. Description: Accounts receivable distribution file.
  3. Attributes: 161 bytes per record, primary input file (IPE), disk-based.
  4. Fields Used:
    • ADCO (4–5): Company number.
    • ADCUST (6–11): Customer number.
    • COCUST (4–11): Combined company and customer number.
    • ADINV# (12–18): Invoice number.
    • ADAMT (19–27): Transaction amount (8.2).
    • ADDISC (29–35): Transaction discount (5.1).
    • ADGLCR (36–43): GL credit amount (5.2).
    • ADGLDR (44–51): GL debit account (5.3).
    • ADJRDT (52–57): Journal date.
    • ADCODR (58–59): Credit code.
    • ADCOCR (60–61): Credit control code.
    • ADNAME (65–84): Customer name.
    • ADCODI (85–86): Discount code.
    • ADGLDI (87–94): GL discount account.
    • ADJRNL (95–98): Journal number.
    • ADMISC (120–128): Miscellaneous amount (8.2).
  5. Purpose: Contains A/R distribution records for journal entry creation.
  6. Usage: Read sequentially to process transactions.

  7. ARCONT:

  8. Description: Accounts receivable control file.
  9. Attributes: 256 bytes per record, input file (IC), 2-byte alternate index, disk-based.
  10. Fields Used:
    • ICRCO: Company number.
    • ICRGL8: GL account.
  11. Purpose: Provides control data for journal entries.
  12. Usage: Chained for company-specific settings.

  13. ARTEMG:

  14. Description: Temporary journal entry file.
  15. Attributes: 128 bytes per record, output file (O), disk-based.
  16. Fields Used:
    • 'A': Entry type.
    • ICRCO, IDRCO, ADCODI: Company or discount code.
    • ADJRNL: Journal number.
    • IC, ID, 'D', 'C': Control or debit/credit indicators.
    • ICRGL8, IDRGL8, ADGLDI: GL accounts.
    • ADNAME: Customer name.
    • ADINV#: Invoice number.
    • ADJRDT: Journal date.
    • CRAMT, ICRAMT, IDRAMT, DISC11: Amounts.
    • 'S': Status.
    • ADDESC: Description (25 characters).
  17. Purpose: Stores journal entries for general ledger integration.
  18. Usage: Written with multiple exception output specifications.

External Programs Called

The AR210 RPG program does not explicitly call any external programs. It is a self-contained program that processes input from ARDIST and ARCONT and writes to ARTEMG.


Summary

The AR210 RPG program, called by the main OCL (e.g., BB600.ocl36.txt), creates A/R journal entries by: - Reading ARDIST records and identifying transaction types (CI, CJ, CP). - Generating journal entries in ARTEMG for cash receipts, journal transactions, payments, and discounts. - Using ARCONT for control data (e.g., company, GL accounts). - Preserving the 25-character description (ADDESC) and moving the date to the second description field (per 4/20/05). - Writing entries with appropriate GL accounts, amounts, and indicators ('D', 'C', 'S'). - Terminating after processing all records.

Tables Used: ARDIST (A/R distribution), ARCONT (A/R control), ARTEMG (temporary journal entries). External Programs Called: None.

This program supports the A/R module of the invoice posting workflow by generating journal entries for general ledger integration, ensuring accurate financial reporting.