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.
- File Initialization:
- 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.
- Defines record formats for
ARDIST
with three condition indicators:CI
(01): Cash transaction.CJ
(02): Journal transaction.CP
(03): Payment or other transaction type.
-
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).
-
Record Processing (ARDIST):
- Reads each record from
ARDIST
sequentially using the RPG cycle (NS 01
,OR 02
,OR 03
). - Identifies the transaction type based on indicators:
CI
(01): Cash transaction.CJ
(02): Journal transaction.CP
(03): Payment or other transaction.
-
Chains to
ARCONT
using a 2-byte alternate index to retrieve control data (e.g., company-specific settings). -
Journal Entry Creation:
- Writes records to
ARTEMG
based on transaction type, using exception output (E
) specifications at different line numbers (e.g., 31, 32, 33, 34, 35). - 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).
- Fields:
- 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.
- 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
.
- Payment Transactions (CP, Line 34):
- Writes payment-related entries:
- Fields:
'A'
(type),IDRCO
(company),ADJRNL
,ID
,IDRGL8
,ADNAME
,ADINV#
,ADJRDT
,IDRAMT
,'S'
,ADDESC
.
-
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
.
- Writes discount entries based on indicator
-
Description Handling (per 4/20/05):
- Preserves the full 25-character description field (
ADDESC
) from cash receipts. -
Moves the date to the beginning of the second description field in
ARTEMG
, ensuring the first field contains the A/R description. -
Cycle Completion:
- Processes all
ARDIST
records, generating journal entries inARTEMG
. - Terminates after processing, closing all files.
Business Rules¶
- Journal Entry Creation:
- Generates journal entries in
ARTEMG
for general ledger integration based on transaction type (CI
,CJ
,CP
). -
Supports cash receipts, journal transactions, payments, and discounts.
-
Transaction Types:
- Cash Transactions (CI): Creates multiple journal entries for cash receipts, likely for different GL accounts or amounts.
- Journal Transactions (CJ): Handles inter-company or other journal entries.
- Payment Transactions (CP): Processes payment-related entries.
-
Discount Transactions: Creates debit or credit entries based on indicator
82
, usingDISC11
for the discount amount. -
Description Preservation (per 4/20/05):
- Retains the full 25-character description (
ADDESC
) from cash receipts. -
Places the journal date (
ADJRDT
) at the beginning of the second description field inARTEMG
. -
Control Data:
-
Uses
ARCONT
to retrieve company-specific control data (e.g.,ICRCO
,ICRGL8
) for journal entries. -
No Validation or Filtering:
- Assumes all
ARDIST
records are valid and suitable for journal entry creation. -
No explicit checks for transaction amounts, dates, or customer data.
-
No Error Handling:
-
Assumes input files (
ARDIST
,ARCONT
) exist and contain valid data, andARTEMG
can be written without issues. -
Integration with A/R Workflow:
- Part of the invoice posting workflow, creating journal entries for A/R transactions to integrate with the general ledger.
Tables (Files) Used¶
- ARDIST:
- Description: Accounts receivable distribution file.
- Attributes: 161 bytes per record, primary input file (
IPE
), disk-based. - 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).
- Purpose: Contains A/R distribution records for journal entry creation.
-
Usage: Read sequentially to process transactions.
-
ARCONT:
- Description: Accounts receivable control file.
- Attributes: 256 bytes per record, input file (
IC
), 2-byte alternate index, disk-based. - Fields Used:
ICRCO
: Company number.ICRGL8
: GL account.
- Purpose: Provides control data for journal entries.
-
Usage: Chained for company-specific settings.
-
ARTEMG:
- Description: Temporary journal entry file.
- Attributes: 128 bytes per record, output file (
O
), disk-based. - 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).
- Purpose: Stores journal entries for general ledger integration.
- 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.