Skip to content

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.

  1. File Initialization:
  2. 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).
  3. Defines arrays:
    • MN: 12 elements, 9 bytes, containing month names (January–December).
  4. Defines an externally described file AR211S for ARTEMG records.

  5. Record Processing (ARTEMG):

  6. Reads each record from ARTEMG sequentially using the RPG cycle (NS 01).
  7. 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).
  8. Chains to GLMAST using an 11-byte alternate index to validate GL accounts.
  9. Chains to ARCONT using a 2-byte alternate index for control data (no updates, per 8/06/14).

  10. Summarization by Account Number:

  11. Summarizes transactions by GL account number (GDACCT) at level breaks (L4 for year/month, L5 for journal type/number).
  12. Accumulates totals:

    • L2TOT$J: Journal transaction amount.
    • L4DB$J: Debit total for journal at L4 (year/month).
    • L4CR$J: Credit total for journal at L4 (year/month).
  13. Journal Entry Creation:

  14. 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 indicator 20 is off).
  15. Writes daily summary records to ARDALY:

    • Fields: Likely include summarized amounts and account details (not fully specified in snippet).
  16. Report Generation:

  17. Prints the Sales and Cash Receipts Journal to REPORT (Bradford) and REPORTP (paperless, per 8/06/14).
  18. 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 indicator 20 off).
    • Totals: L4DB$J (debit), L4CR$J (credit) at L4 (year/month) with “JOURNAL TOTALS” label.
    • Formatting with separators (e.g., * * *).
  19. Description Handling (per 4/20/05):

  20. Preserves the full 25-character description field from cash receipts.
  21. Moves the date to the beginning of the second description field in TEMGEN, ensuring the first field contains the A/R description.

  22. Cycle Completion:

  23. Processes all ARTEMG records, summarizing by account number, writing to TEMGEN and ARDALY, and printing reports.
  24. Outputs totals at L4 (year/month) level breaks.
  25. Terminates after processing, closing all files.

Business Rules

  1. Journal Summarization:
  2. Summarizes ARTEMG records by GL account number (GDACCT) at year/month (L4) and journal type/number (L5) levels.
  3. Accumulates debit (L4DB$J) and credit (L4CR$J) totals for journals.

  4. Output Files:

  5. Writes final journal entries to TEMGEN for general ledger integration.
  6. Writes daily A/R summaries to ARDALY for reporting or further processing.

  7. Report Generation:

  8. Produces Sales and Cash Receipts Journal in REPORT (Bradford) and REPORTP (paperless, per 8/06/14).
  9. Includes transaction details, GL accounts, amounts, and journal totals.
  10. Uses month names (MN array) for date formatting.

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

  12. Retains the full 25-character description from cash receipts.
  13. Places the date at the beginning of the second description field in TEMGEN.

  14. No ARCONT Update (per 8/06/14):

  15. Removed updates to ARCONT as they are no longer needed, though the file is still read for control data.

  16. GL Account Validation:

  17. Chains to GLMAST to validate GL accounts (GDACCT) used in journal entries.

  18. No Error Handling:

  19. Assumes input files (ARTEMG, AR211S, GLMAST, ARCONT) exist and contain valid data.
  20. Assumes output files (TEMGEN, ARDALY, REPORT, REPORTP) can be written without issues.

  21. Integration with A/R Workflow:

  22. Part of the invoice posting workflow, summarizing A/R journal entries for general ledger and daily reporting.

Tables (Files) Used

  1. ARTEMG:
  2. Description: Temporary A/R journal entry file.
  3. Attributes: 128 bytes per record, primary input file (IP), disk-based.
  4. 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.
  5. Purpose: Contains temporary A/R journal entries to be summarized.
  6. Usage: Read sequentially for processing.

  7. AR211S:

  8. Description: Summarized or temporary journal file (externally described).
  9. Attributes: 300 bytes per record, input file (IR), 3-byte key, externally described (EDISK).
  10. Purpose: Likely used for intermediate summarization or validation.
  11. Usage: Read for journal processing (specific role unclear from snippet).

  12. GLMAST:

  13. Description: General ledger master file.
  14. Attributes: 256 bytes per record, input file (IC), 11-byte alternate index, disk-based.
  15. Purpose: Contains GL account master data for validation.
  16. Usage: Chained to validate GDACCT.

  17. ARCONT:

  18. Description: Accounts receivable control file.
  19. Attributes: 256 bytes per record, input file (IC), 2-byte alternate index, disk-based.
  20. Purpose: Provides control data for journal processing.
  21. Usage: Chained for company-specific settings (no updates, per 8/06/14).

  22. TEMGEN:

  23. Description: Final journal entry file.
  24. Attributes: 128 bytes per record, output file (O), add capability (A), disk-based.
  25. 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).
  26. Purpose: Stores summarized journal entries for general ledger.
  27. Usage: Written with summarized entries.

  28. ARDALY:

  29. Description: Daily A/R summary file.
  30. Attributes: 96 bytes per record, output file (O), add capability (A), disk-based.
  31. Purpose: Stores daily A/R summaries.
  32. Usage: Written with summarized data.

  33. REPORT:

  34. Description: Sales and Cash Receipts Journal printer file (Bradford).
  35. Attributes: 132 bytes per record, printer file (O), overflow indicator (OF).
  36. Fields Used:
    • JRNTYP, JRN#, JRNSEQ, GDDATEY, GLDESC, GDACCT, L2TOT$J, GDTRAN, L4DB$J, L4CR$J.
  37. Purpose: Prints the Sales and Cash Receipts Journal.
  38. Usage: Written with journal details and totals.

  39. REPORTP:

  40. Description: Sales and Cash Receipts Journal printer file (paperless).
  41. Attributes: 132 bytes per record, printer file (O), overflow indicator (OA).
  42. Fields Used: Same as REPORT.
  43. Purpose: Creates paperless version of the journal (per 8/06/14).
  44. 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.