Skip to content

List of Use Cases Implemented by the AR156 Program Call Stack

The AR156 program call stack, comprising AR156.ocl36, AR156P.rpgle, AR135TC.clp, AR137A.ocl36, AR137A.rpg36, and AR156.rpg36, implements a single primary use case:

  1. Generate NACHA-Compliant EFT File for Accounts Receivable Withdrawals:
  2. This use case involves validating input parameters, processing EFT transaction data, creating a bank upload table, generating a NACHA-compliant file for EFT withdrawals through PNC Bank, and producing a report for auditing. The process ensures that only valid EFT participants are included, and the output file adheres to NACHA standards for submission to the bank.

Function Requirement Document: Generate NACHA-Compliant EFT File

Function Requirement Document: Generate NACHA-Compliant EFT File

Overview

This function generates a NACHA-compliant file for Electronic Funds Transfer (EFT) withdrawals from accounts receivable for submission to PNC Bank, along with an audit report. It processes input data, validates parameters, and creates a bank upload table, ensuring compliance with NACHA standards and company-specific EFT rules.

Inputs

  • Company Number (KYCO, 2 digits): Identifies the company processing EFTs.
  • Batch Create Date (KYUPDT, 6 digits, YYMMDD): Specifies the date for selecting EFT transactions.
  • File Group (P$FGRP, 1 character): Library prefix for dynamic file naming.
  • EFT Transaction Data (AREFTD, input file): Contains transaction details (e.g., customer, invoice amount, discount, date).
  • Customer Master Data (ARCUST): Contains customer details, including EFT participation status.
  • Company Control Data (ARCONT): Contains company settings, including EFT configuration.
  • Customer-Specific Data (ARCUSP): Contains EFT banking details (e.g., routing number, account number).

Outputs

  • NACHA File (EFTFILE, 94-byte records): NACHA-compliant file with File Header, Batch Header, Entry Detail, Batch Control, and File Control records, padded to a multiple of 10 records.
  • EFT Report (REPORT, 132-byte printer file): Audit report listing EFT transactions by customer.
  • Bank Upload Table (AREFTS, 100-byte records): Staging file with summarized EFT data per customer.
  • Status Indicator (STATUS, 1 character): 'Y' for successful validation, 'N' for failure.

Process Steps

  1. Validate Inputs:
  2. Verify KYCO exists in ARCONT.
  3. Ensure KYUPDT is non-zero.
  4. Check if the EFT data file (P$FGRP + 'E' + KYUPDT) exists in QS36F.
  5. Return STATUS = 'N' if any validation fails.

  6. Prepare EFT Data:

  7. Copy EFT data from QS36F/P$FGRP + 'E' + KYUPDT to AREFTD, replacing existing data.
  8. Clear AREFTS to ensure a clean staging file.

  9. Process EFT Transactions:

  10. For each customer in AREFTD with AREFT = 'Y' in ARCUST:
    • Retrieve customer details (ARNAME, CSARTE, CSABK#) from ARCUST and ARCUSP.
    • Calculate EFT amount: AFEAMT = AFAMT - AFDISC (invoice amount minus discount).
    • Accumulate totals at customer (L2) and file (LR) levels: invoice amount (AFAMT), discount (AFDISC), EFT amount (AFEAMT).
    • Convert dates (AFSLDT, KYUPDT) to 8-digit format (20YYMMDD) for NACHA compliance.
    • Write summarized data to AREFTS (e.g., AFCO, AFCUST, L2IAMT, L2DAMT, L2EAMT, AFDAT8, AFUPD8).
  11. Generate an EFT report with customer details, totals, and email addresses for spooling.

  12. Generate NACHA File:

  13. Write File Header Record (RECTY1): Includes PNC Bank ABA numbers, transmission date/time, company name ('AMERICAN REFINING GROUP'), and reference code ('EFT DRAW').
  14. For each company (AFCO):
    • Write Batch Header Record (RECTY5): Includes service class code '200', company name ('AMERREFINING ACH'), federal tax ID, and effective date.
    • For each customer (AFCUST):
    • Write Entry Detail Record (RECTY6): Includes transaction code '27', customer bank routing (CSARTE), account number (CSABK#), EFT amount (AFEAMT), and customer name.
    • Update batch and file counters (L2CNT, LRCNT) and hash totals (L2HASH, LRHASH) using routing number.
    • Write Batch Control Record (RECTY8): Summarizes batch entry count, hash, and debit total.
  15. Write File Control Record (RECTY9): Summarizes batch count, block count, entry count, hash, and debit total.
  16. Pad the file with filler records ('999999...') to a multiple of 10 records (blocking factor 10).

  17. Clean Up:

  18. Delete temporary file P$FGRP + AR156S if it exists.
  19. Clear local variables.

Business Rules

  1. Validation:
  2. Company number must exist in ARCONT.
  3. Batch create date must be non-zero and correspond to an existing EFT data file.
  4. Only customers with AREFT = 'Y' in ARCUST are processed.

  5. EFT Amount Calculation:

  6. AFEAMT = AFAMT - AFDISC for each transaction, accumulated at customer and file levels.

  7. NACHA Compliance:

  8. File adheres to NACHA format with fixed record types, lengths (94 bytes), and blocking factor (10 records).
  9. Includes PNC Bank ABA numbers ('043000096', '04300009'), federal tax ID ('1222318612'), and company details.

  10. Dynamic File Naming:

  11. Uses P$FGRP for library prefix and KYUPDT for date-specific file names (e.g., P$FGRP + 'E' + KYUPDT).

  12. Reporting:

  13. Generates a report with customer details, EFT amounts, and totals, including email addresses for automated spooling.

  14. Data Integrity:

  15. Clears AREFTS before processing to prevent residual data.
  16. Maintains accurate entry counts, hash totals (based on routing numbers), and debit totals for NACHA compliance.

Calculations

  • EFT Amount: AFEAMT = AFAMT - AFDISC (packed decimal, 9 digits, 2 decimal places).
  • Date Conversion: AFSLDT and KYUPDT (6-digit YYMMDD) multiplied by 10000.01 and prefixed with '20' to form 8-digit dates (20YYMMDD).
  • Hash Totals: Sum of customer bank routing numbers (CSARTE) for batch (L2HASH) and file (LRHASH).
  • Block Count: LRBLOK = RECCNT / 10, rounded up if remainder exists.
  • Padding: Filler records added until RECCNT reaches LRBLOK * 10.

Dependencies

  • Files:
  • Input: AREFTD, ARCUST, ARCONT, ARCUSP.
  • Output: AREFTS, EFTFILE, REPORT.
  • External Program: GSGENIEC (environment setup, called by AR156.ocl36).

Below is a table summarizing the programs provided (AR156.ocl36, AR156P.rpgle, AR135TC.clp, AR137A.ocl36, AR137A.rpg36, AR156.rpg36), including their general purpose and outputs. The table is presented as a Markdown artifact, as per the requirements for generating structured content.

Program Summary Table

Program File General Purpose Outputs
AR156.ocl36 Orchestrates the EFT process, calling programs to validate inputs, process EFT data, and generate a NACHA file for PNC Bank. STATUS ('Y' or 'N'), AREFTS (staging file), EFTFILE (NACHA file), temporary files deleted.
AR156P.rpgle Validates company number and batch date, ensuring the EFT data file exists. STATUS ('Y' or 'N'), updated KYCO, KYUPDT, error messages in AR156PD display file.
AR135TC.clp Checks if a specified EFT data file exists in the QS36F library. STATUS ('Y' if file exists, 'N' if not).
AR137A.ocl36 Clears the staging file and initiates EFT data processing and report generation. Cleared AREFTS file, triggers AR137A.rpg36 execution.
AR137A.rpg36 Processes EFT transactions, creates a bank upload table, and generates a report. AREFTS (populated with EFT data), EFT report (printer file).
AR156.rpg36 Generates a NACHA-compliant file for EFT withdrawals and an audit report. EFTFILE (NACHA file with header, batch, detail, control, and filler records), REPORT (printer file).