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.
- File Initialization:
- 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).
-
Defines arrays:
AGE
: 5 elements, 9 digits, 2 decimals, for aged customer balances.MN
: 12 elements, 9 bytes, containing month names (January–December).
-
Record Processing (ARTRAN):
- Reads each record from
ARTRAN
sequentially using the RPG cycle (NS 01
). - 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.
-
Processes transactions to update files and generate reports based on customer type (inter-company or regular).
-
Customer Type Check (Inter-Company Handling):
- Checks if the customer is an inter-company customer (criteria not specified in snippet, likely based on
ATCUST
or a flag). - For inter-company customers:
- Skips updates to
ARCUST
,ARDETL
, andARHIST
. - Generates journal entries in
ARDIST
for accounting purposes.
- Skips updates to
-
For regular customers:
- Updates
ARCUST
,ARDETL
, andARHIST
. - Generates journal entries in
ARDIST
.
- Updates
-
Update Customer and Detail Files:
- ARCUST:
- Updates customer master records with transaction data (e.g., balance, aging).
- Chains using
ATCOCU
(company + customer number) to locate records.
- 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#
).
-
Calculates aged balances using the
AGE
array for customer aging (e.g., current, 30, 60, 90, 120+ days). -
Generate History and Distribution Records:
- ARHIST:
- Writes history records (128 bytes) to
ARHIST
for non-inter-company customers, capturing transaction history.
- Writes history records (128 bytes) to
-
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.
- Writes distribution records (161 bytes) to
-
Date Conversion:
-
Converts detail and history dates to YMD (Year-Month-Day) format for consistency in
ARDETL
andARHIST
. -
Print Transaction Posting Register:
- Outputs a Transaction Posting Register to
REPORT
(Bradford printing) andREPORTP
(paperless report, per 8/06/14). - 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.,
* * *
,****
).
- Transaction details: Company (
-
Removed printing for W. Conshohocken (per 8/06/14).
-
Cycle Completion:
- Processes all
ARTRAN
records, updating files and printing reports. - Outputs totals at level breaks (
L1
, company level) for invoices, receivables, miscellaneous, discounts, cash, and A/R. - Terminates after processing, closing all files.
Business Rules¶
- Inter-Company Customers:
- Do not update
ARCUST
,ARDETL
, orARHIST
. -
Generate journal entries in
ARDIST
for accounting integration. -
Regular Customers:
- Update
ARCUST
with customer balance and aging information. - Update or add
ARDETL
records with transaction details. - Write
ARHIST
records for transaction history. -
Generate journal entries in
ARDIST
. -
Date Conversion:
-
Converts all dates in
ARDETL
andARHIST
to YMD format for consistency. -
Aging Calculations:
-
Uses the
AGE
array to calculate aged customer balances (e.g., current, 30, 60, 90, 120+ days) based on transaction dates. -
Transaction Posting Register:
- Prints a detailed report with transaction and total information.
- Supports paperless report creation via
REPORTP
(per 8/06/14). - Includes company-level totals (
L1
) for invoices, receivables, miscellaneous, discounts, cash, and A/R net change. -
Removed W. Conshohocken printing (per 8/06/14).
-
Description Handling (per 4/20/05):
- Preserves the entire 25-character description field from cash receipts in
ARDETL
. -
Moves the date to the beginning of the second description field in
TEMGEN
(temporary journal entry file, not listed in files but implied). -
No Error Handling:
- Assumes input files (
ARTRAN
,ARCUST
,ARDETL
,ARCONT
) exist and contain valid data. -
Assumes output files (
ARHIST
,ARDIST
,REPORT
,REPORTP
) can be written without issues. -
Integration with A/R Workflow:
- Part of the invoice posting workflow, processing A/R transactions to update customer records and generate financial reports.
Tables (Files) Used¶
- ARTRAN:
- Description: Accounts receivable transaction file.
- Attributes: 2560 bytes per record, primary input/update file (
UP
), disk-based. - 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.
- Purpose: Contains A/R transactions to be processed.
-
Usage: Read sequentially, updated as needed.
-
ARDETL:
- Description: Accounts receivable detail file.
- Attributes: 128 bytes per record, update file (
UC
), 18-byte alternate index, add capability (A
), disk-based. - Purpose: Stores detailed A/R transaction records.
-
Usage: Updated or added with transaction details.
-
ARCUST:
- Description: Customer master file.
- Attributes: 384 bytes per record, update file (
UC
), 8-byte alternate index, add capability (A
), disk-based. - Purpose: Stores customer master data (e.g., balances, aging).
-
Usage: Updated with customer balance and aging information.
-
ARCONT:
- Description: Accounts receivable control file.
- Attributes: 256 bytes per record, update file (
UC
), 2-byte alternate index, disk-based. - Purpose: Contains control data for A/R processing.
-
Usage: Referenced for control information.
-
ARHIST:
- Description: Accounts receivable history file.
- Attributes: 128 bytes per record, output file (
O
), add capability (A
), disk-based. - Purpose: Stores A/R transaction history for non-inter-company customers.
-
Usage: Written with history records.
-
ARDIST:
- Description: Accounts receivable distribution file.
- Attributes: 161 bytes per record, output file (
O
), disk-based. - Purpose: Stores distribution records (e.g., journal entries for general ledger).
-
Usage: Written for all customers, including inter-company.
-
REPORT:
- Description: Transaction Posting Register printer file (Bradford).
- Attributes: 164 bytes per record, printer file (
O
), overflow indicator (OF
). - 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.
- Purpose: Prints the Transaction Posting Register.
-
Usage: Written with report details and totals.
-
REPORTP:
- Description: Transaction Posting Register printer file (paperless).
- Attributes: 164 bytes per record, printer file (
O
), overflow indicator (OA
). - Fields Used: Same as
REPORT
. - Purpose: Creates paperless version of the Transaction Posting Register.
- 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.