AR211 RPG36
The AR211.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 temporary journal entries from the ARTEMG
file, summarize them by account number, and generate sales and cash receipts journals. It writes summarized records to TEMGEN
and ARDALY
files and produces printed reports via REPORT
(Bradford printing) and REPORTP
(paperless, per 8/06/14 revision). The program no longer updates the ARCONT
file (per 8/06/14) and preserves the full 25-character description field from cash receipts (per 4/20/05). Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.
Process Steps of the AR211 RPG Program¶
The AR211
program reads journal entries from ARTEMG
, summarizes them by account number, and generates output for journals and reports. It uses GLMAST
for general ledger account validation, ARCONT
for control data, and produces outputs in TEMGEN
, ARDALY
, REPORT
, and REPORTP
.
- File Initialization:
- The program opens the following files:
- Input Files:
ARTEMG
: Primary input file (IP
), 128 bytes per record, disk-based. Contains temporary A/R journal entries.AR211S
: Input file (IR
), 300 bytes, 3-byte key, externally described (EDISK
). Likely a summarized or temporary file for journal processing.GLMAST
: Input file (IC
), 256 bytes, 11-byte alternate index, disk-based. Contains general ledger master data.ARCONT
: Input file (IC
), 256 bytes, 2-byte alternate index, disk-based. Contains A/R control data (no longer updated, per 8/06/14).- Output Files:
TEMGEN
: Output file (O
), 128 bytes, add capability (A
), disk-based. Stores final journal entries for general ledger.ARDALY
: Output file (O
), 96 bytes, add capability (A
), disk-based. Stores daily A/R summary records.REPORT
: Printer file (O
), 132 bytes, overflow indicator (OF
). Used for printing the Sales and Cash Receipts Journal in Bradford.REPORTP
: Printer file (O
), 132 bytes, overflow indicator (OA
). Used for paperless report creation (per 8/06/14).
- Defines arrays:
MN
: 12 elements, 9 bytes, containing month names (January–December).
-
Defines an externally described file
AR211S
forARTEMG
records. -
Record Processing (ARTEMG):
- Reads each record from
ARTEMG
sequentially using the RPG cycle (NS 01
). - Key fields extracted:
GDDEL
(1): Delete flag.GDCO
(2–3): Company number (level 6,L6
).GDJTYPL5
(4–5): Journal type (level 5,L5
).GDJRN#L5
(6–7): Journal number (level 5,L5
).GDREF
(8–11): Reference number.GDCRDBL1
(12): Credit/debit indicator.GDACCTL2
(13–20): GL account control.GDT…
: Partial field (likely transaction date or description, truncated).GDYR
(55–56): Year (level 4,L4
).GDMO
(51–52): Month (level 4,L4
).
- Chains to
GLMAST
using an 11-byte alternate index to validate GL accounts. -
Chains to
ARCONT
using a 2-byte alternate index for control data (no updates, per 8/06/14). -
Summarization by Account Number:
- Summarizes transactions by GL account number (
GDACCT
) at level breaks (L4
for year/month,L5
for journal type/number). -
Accumulates totals:
L2TOT$J
: Journal transaction amount.L4DB$J
: Debit total for journal atL4
(year/month).L4CR$J
: Credit total for journal atL4
(year/month).
-
Journal Entry Creation:
- Writes summarized journal entries to
TEMGEN
:- Fields:
JRNTYP
(journal type),JRN#
(journal number),JRNSEQ
(journal sequence),GDDATEY
(date in YMD format),GLDESC
(description),GDACCT
(GL account),L2TOT$J
(amount),GDTRAN
(transaction details, conditionally written if indicator20
is off).
- Fields:
-
Writes daily summary records to
ARDALY
:- Fields: Likely include summarized amounts and account details (not fully specified in snippet).
-
Report Generation:
- Prints the Sales and Cash Receipts Journal to
REPORT
(Bradford) andREPORTP
(paperless, per 8/06/14). -
Report includes:
- Headers: “JOURNAL”, “DEBIT”, “CREDIT”, “REFERENCE SOURCE”, “DESCRIPTION”, “G/L NO AMOUNT”.
- Transaction details:
JRNTYP
,JRN#
,JRNSEQ
,GDDATEY
,GLDESC
,GDACCT
,L2TOT$J
,GDTRAN
(if indicator20
off). - Totals:
L4DB$J
(debit),L4CR$J
(credit) atL4
(year/month) with “JOURNAL TOTALS” label. - Formatting with separators (e.g.,
* * *
).
-
Description Handling (per 4/20/05):
- Preserves the full 25-character description field from cash receipts.
-
Moves the date to the beginning of the second description field in
TEMGEN
, ensuring the first field contains the A/R description. -
Cycle Completion:
- Processes all
ARTEMG
records, summarizing by account number, writing toTEMGEN
andARDALY
, and printing reports. - Outputs totals at
L4
(year/month) level breaks. - Terminates after processing, closing all files.
Business Rules¶
- Journal Summarization:
- Summarizes
ARTEMG
records by GL account number (GDACCT
) at year/month (L4
) and journal type/number (L5
) levels. -
Accumulates debit (
L4DB$J
) and credit (L4CR$J
) totals for journals. -
Output Files:
- Writes final journal entries to
TEMGEN
for general ledger integration. -
Writes daily A/R summaries to
ARDALY
for reporting or further processing. -
Report Generation:
- Produces Sales and Cash Receipts Journal in
REPORT
(Bradford) andREPORTP
(paperless, per 8/06/14). - Includes transaction details, GL accounts, amounts, and journal totals.
-
Uses month names (
MN
array) for date formatting. -
Description Preservation (per 4/20/05):
- Retains the full 25-character description from cash receipts.
-
Places the date at the beginning of the second description field in
TEMGEN
. -
No ARCONT Update (per 8/06/14):
-
Removed updates to
ARCONT
as they are no longer needed, though the file is still read for control data. -
GL Account Validation:
-
Chains to
GLMAST
to validate GL accounts (GDACCT
) used in journal entries. -
No Error Handling:
- Assumes input files (
ARTEMG
,AR211S
,GLMAST
,ARCONT
) exist and contain valid data. -
Assumes output files (
TEMGEN
,ARDALY
,REPORT
,REPORTP
) can be written without issues. -
Integration with A/R Workflow:
- Part of the invoice posting workflow, summarizing A/R journal entries for general ledger and daily reporting.
Tables (Files) Used¶
- ARTEMG:
- Description: Temporary A/R journal entry file.
- Attributes: 128 bytes per record, primary input file (
IP
), disk-based. - Fields Used:
GDDEL
(1): Delete flag.GDCO
(2–3): Company number.GDJTYPL5
(4–5): Journal type.GDJRN#L5
(6–7): Journal number.GDREF
(8–11): Reference number.GDCRDBL1
(12): Credit/debit indicator.GDACCTL2
(13–20): GL account control.GDYR
(55–56): Year.GDMO
(51–52): Month.GDDATEY
: Date in YMD format.GDACCT
: GL account.GDTRAN
: Transaction details.GLDESC
: Description.
- Purpose: Contains temporary A/R journal entries to be summarized.
-
Usage: Read sequentially for processing.
-
AR211S:
- Description: Summarized or temporary journal file (externally described).
- Attributes: 300 bytes per record, input file (
IR
), 3-byte key, externally described (EDISK
). - Purpose: Likely used for intermediate summarization or validation.
-
Usage: Read for journal processing (specific role unclear from snippet).
-
GLMAST:
- Description: General ledger master file.
- Attributes: 256 bytes per record, input file (
IC
), 11-byte alternate index, disk-based. - Purpose: Contains GL account master data for validation.
-
Usage: Chained to validate
GDACCT
. -
ARCONT:
- Description: Accounts receivable control file.
- Attributes: 256 bytes per record, input file (
IC
), 2-byte alternate index, disk-based. - Purpose: Provides control data for journal processing.
-
Usage: Chained for company-specific settings (no updates, per 8/06/14).
-
TEMGEN:
- Description: Final journal entry file.
- Attributes: 128 bytes per record, output file (
O
), add capability (A
), disk-based. - Fields Used:
JRNTYP
: Journal type.JRN#
: Journal number.JRNSEQ
: Journal sequence.GDDATEY
: Date in YMD format.GLDESC
: Description (25 characters).GDACCT
: GL account.L2TOT$J
: Journal amount.GDTRAN
: Transaction details (conditional).
- Purpose: Stores summarized journal entries for general ledger.
-
Usage: Written with summarized entries.
-
ARDALY:
- Description: Daily A/R summary file.
- Attributes: 96 bytes per record, output file (
O
), add capability (A
), disk-based. - Purpose: Stores daily A/R summaries.
-
Usage: Written with summarized data.
-
REPORT:
- Description: Sales and Cash Receipts Journal printer file (Bradford).
- Attributes: 132 bytes per record, printer file (
O
), overflow indicator (OF
). - Fields Used:
JRNTYP
,JRN#
,JRNSEQ
,GDDATEY
,GLDESC
,GDACCT
,L2TOT$J
,GDTRAN
,L4DB$J
,L4CR$J
.
- Purpose: Prints the Sales and Cash Receipts Journal.
-
Usage: Written with journal details and totals.
-
REPORTP:
- Description: Sales and Cash Receipts Journal printer file (paperless).
- Attributes: 132 bytes per record, printer file (
O
), overflow indicator (OA
). - Fields Used: Same as
REPORT
. - Purpose: Creates paperless version of the journal (per 8/06/14).
- Usage: Written with journal details and totals.
External Programs Called¶
The AR211
RPG program does not explicitly call any external programs. It is a self-contained program that processes input from ARTEMG
, AR211S
, GLMAST
, and ARCONT
, and writes to TEMGEN
, ARDALY
, REPORT
, and REPORTP
.
Summary¶
The AR211
RPG program, called by the main OCL (e.g., BB600.ocl36.txt
), generates Sales and Cash Receipts Journals by:
- Reading ARTEMG
records and summarizing by GL account number (GDACCT
) at year/month (L4
) and journal type/number (L5
) levels.
- Validating GL accounts with GLMAST
and retrieving control data from ARCONT
(no updates, per 8/06/14).
- Writing summarized journal entries to TEMGEN
and daily summaries to ARDALY
.
- Printing journals to REPORT
(Bradford) and REPORTP
(paperless, per 8/06/14) with transaction details and totals.
- Preserving the 25-character description and moving the date to the second description field in TEMGEN
(per 4/20/05).
- Terminating after processing all records.
Tables Used: ARTEMG
(temporary journal entries), AR211S
(summarized journal file), GLMAST
(GL master), ARCONT
(A/R control), TEMGEN
(final journal entries), ARDALY
(daily A/R summary), REPORT
(printer), REPORTP
(paperless printer).
External Programs Called: None.
This program supports the A/R module of the invoice posting workflow by summarizing journal entries and producing detailed financial reports for general ledger integration.