Skip to content

AR931 RPG36

The provided document, AR931.rpg36.txt, is an RPG program for the IBM System/36, named AR931, which generates an Accounts Receivable (A/R) Control File Listing. This program is called from the main OCL script (AR931P.ocl36.txt) after user input is validated by the AR931P RPGLE program. The AR931 program reads data from the A/R control file and produces a formatted report on a printer. Below, I’ll explain the process steps, business rules, tables/files used, and any external programs called, integrating context from the OCL script and the AR931P program for a comprehensive understanding.

Process Steps of the RPG Program

The AR931 program is a straightforward RPG program designed to read records from the A/R control file (ARCONT) and print a formatted report. It operates in a simple input-processing-output cycle, with headers and detail lines for each valid record. Here’s a detailed breakdown of the process steps:

  1. Program Initialization:
  2. Header Specifications:
    • H P016 B AR931: Specifies the program name (AR931) with a program number (P016) and batch mode (B), indicating it’s designed for batch processing.
  3. File Definitions:
    • FARCONT IP F 256 256 DISK: Defines ARCONT as the primary input file (256-byte records, disk-based), read sequentially.
    • FPRINT O F 160 160 OF PRINTER: Defines PRINT as the output file (160-byte records) for printing the report, with overflow indicator OF.
  4. Array Definitions:
    • E SEP 66 2: Defines a 2-element array SEP with 66 bytes each, used for separator lines (likely asterisks, initialized in the program).
    • E SEP2 16 2: Defines a 2-element array SEP2 with 16 bytes each, used for additional separator lines.
  5. Input Specifications:
    • IARCONT NS 01: Defines the input record format for ARCONT with fields:
    • ACDEL (1): Delete flag ('D' for deleted records).
    • ACCO (2-3): Company number (originally 2-30, likely a typo or legacy format; used as 2-3 in output).
    • ACNAME (4-33): Company name.
    • ACARJ# (34-35): Next A/R journal number.
    • ACSLJ# (36-37): Next sales journal number.
    • ACARGL (38-45): A/R general ledger number.
    • ACSLGL (46-53): Sales general ledger number.
    • ACDSGL (54-61): Discount general ledger number.
    • ACCSGL (62-69): Cash general ledger number.
    • ACICGL (70-77): Intercompany general ledger number.
    • ACDATE (78-83): Last aging date.
    • ACSECR (84-91): Security code for statements.
    • ACFINC (92-96.4): Finance charge percentage (4 decimal places).
    • ACFNGL (97-104): Finance general ledger number.
    • ACFFMO (105-106): First fiscal month.
    • ACLMT1 (107-108): Aging bucket 1 upper limit (1-30 days).
    • ACLMT2 (109-110): Aging bucket 2 upper limit (31-60 days).
    • ACLMT3 (111-112): Aging bucket 3 upper limit (61-90 days).
    • ACLMT4 (123-125): Aging bucket 4 upper limit (91-120 days, added in revision JB01).
  6. Variables:

    • TIMDAT (12 bytes), TIME (6 bytes), DATE (6 bytes): Used to capture and format the system date and time.
    • PAGE: Used for page numbering in the report.
  7. Initial Setup (Calculation Specifications):

  8. C N11 SETOF 15: If indicator 11 is off (no overflow), clears the overflow indicator 15.
  9. C N11 MOVE '* ' SEP: Initializes the SEP array with asterisks for separator lines.
  10. C N11 MOVE '* ' SEP2: Initializes the SEP2 array with asterisks for additional separator lines.
  11. C N11 TIME TIMDAT 120: Retrieves the system date and time into TIMDAT.
  12. C N11 MOVELTIMDAT TIME 60: Moves the time portion to TIME (6 bytes).
  13. C N11 MOVE TIMDAT DATE 60: Moves the date portion to DATE (6 bytes).
  14. C N11 SETON 1115: Sets indicators 11 (control break) and 15 (overflow) to ensure headers are printed at the start.

  15. Report Generation (Output Specifications):

  16. The program reads ARCONT sequentially (as the primary file) and processes each record:
    • Record Filtering: Skips records where ACDEL = 'D' (deleted records), as implied by standard System/36 practices, though not explicitly coded in the RPG (likely handled by the OCL or AR931P validation).
  17. Output to PRINT:
    • Header Lines (D 103, D 2, D 1):
    • Printed when indicator 15 (overflow) is on or at the start (N15 for first page).
    • D 103: Prints page number (PAGE) and date (DATE) at positions 104-108 and 120-129.
    • D 2: Prints the report title ("A/R CONTROL FILE LISTING") and time (TIME) at positions 78 and 120-129.
    • D 1: Prints separator lines (SEP, SEP2) and column headers (e.g., "CO#", "COMPANY NAME", "A/R G/L#", etc.) at various positions.
    • D 1: Additional headers for "NEXT" (journal numbers), "GL", "FIRST FISCAL MONTH", and "AGING BUCKETS".
    • Detail Lines (D 3):
    • Printed for each non-deleted ARCONT record.
    • Outputs fields: ACCO (3), ACNAME (35), ACARGL (45), ACCSGL (56), ACDSGL (67), ACICGL (78), ACARJ# (84), ACSLJ# (88), ACFINC2 (96, formatted finance charge), ACFNGLZ (105, formatted finance GL), ACSECR (114), ACFFMO (129), ACLMT1 (141), ACLMT2 (145), ACLMT3 (149), ACLMT4 (155).
  18. Overflow Handling: The OF indicator triggers header reprinting when the page length (160 characters, likely with a standard line count) is exceeded.

  19. Program Flow:

  20. The RPG cycle automatically reads each ARCONT record, processes it, and writes to PRINT until end-of-file.
  21. Headers are printed at the start of the report and on page overflows.
  22. Detail lines are printed for each valid record, showing A/R control data.

Business Rules

The AR931 program enforces the following business rules for the A/R Control File Listing:

  1. Report Content:
  2. The report lists all non-deleted records from ARCONT (filtered implicitly or by AR931P).
  3. For each company, it includes:

    • Company number (ACCO) and name (ACNAME).
    • General ledger numbers for A/R (ACARGL), cash (ACCSGL), discount (ACDSGL), and intercompany (ACICGL).
    • Next journal numbers for A/R (ACARJ#) and sales (ACSLJ#).
    • Finance charge percentage (ACFINC), finance GL number (ACFNGL), and security code (ACSECR).
    • First fiscal month (ACFFMO).
    • Aging bucket upper limits: 1-30 days (ACLMT1), 31-60 days (ACLMT2), 61-90 days (ACLMT3), 91-120 days (ACLMT4).
  4. Aging Buckets (Revision JB01):

  5. Per the revision log (dated 04/13/05), aging is based on invoice date rather than due date, as modified for PNC Bank.
  6. Aging buckets are:
    • 0-30 days (ACLMT1).
    • 31-60 days (ACLMT2).
    • 61-90 days (ACLMT3).
    • 91-120 days (ACLMT4).
    • Over 120 days (implicit, not stored in a specific field).
  7. This change aligns with financial reporting requirements for tracking receivables by invoice age.

  8. Report Formatting:

  9. The report includes a header with the title, date, time, and page number.
  10. Separator lines (SEP, SEP2) and column headers ensure readability.
  11. Fields are positioned at specific columns (e.g., ACCO at 3, ACNAME at 35) for consistent formatting.

  12. Record Filtering:

  13. Only non-deleted records (ACDEL ≠ 'D') are included, ensuring the report reflects active companies.
  14. The AR931P program (called earlier in the OCL) validates company selections (ALL or specific companies), so AR931 processes only the selected records.

  15. Output Control:

  16. The number of copies (KYCOPY) is set by AR931P and passed via the OCL script.
  17. The report can be run interactively or submitted to a job queue (KYJOBQ), as determined by AR931P and the OCL script.

Tables/Files Used

  1. ARCONT:
  2. Type: Primary input file (disk, 256 bytes).
  3. Purpose: Stores Accounts Receivable control data, including company details, GL numbers, journal numbers, finance charges, and aging bucket limits.
  4. Fields:

    • ACDEL: Delete flag.
    • ACCO: Company number.
    • ACNAME: Company name.
    • ACARJ#, ACSLJ#: Journal numbers.
    • ACARGL, ACSLGL, ACDSGL, ACCSGL, ACICGL: GL numbers.
    • ACDATE: Last aging date.
    • ACSECR: Security code.
    • ACFINC: Finance charge percentage.
    • ACFNGL: Finance GL number.
    • ACFFMO: First fiscal month.
    • ACLMT1, ACLMT2, ACLMT3, ACLMT4: Aging bucket limits.
  5. PRINT:

  6. Type: Output file (printer, 160 bytes).
  7. Purpose: Receives the formatted report output, including headers and detail lines for each ARCONT record.

External Programs Called

The AR931 program does not explicitly call any external programs using CALL operations. However, it is part of a workflow orchestrated by the OCL script (AR931P.ocl36.txt):

  • AR931P:
  • Called before AR931 in the OCL script (// LOAD AR931P and // RUN).
  • Validates user input (company selection, job queue, copies) and sets parameters (KYALCO, KYCO1, KYCO2, KYCO3, KYJOBQ, KYCOPY) used to control AR931 execution.
  • Not called by AR931 but provides input parameters via the data area (UDS).

  • GSGENIEC and SCPROCP:

  • Called in the OCL script before AR931P (// CALL PGM(GSGENIEC) and // SCPROCP).
  • Likely handle system setup or environment configuration but are not directly referenced in AR931.

Integration with OCL and AR931P

The OCL script (AR931P.ocl36.txt) and AR931P RPGLE program provide the context for AR931: - OCL Script: - Loads AR931P to collect and validate user input, then either submits AR931 to a job queue (// IF ?L'120,1'?/Y JOBQ ?CLIB?,AR931) or runs it directly (// ELSE AR931). - Passes the ARCONT file and parameters (e.g., ?9? for library) to AR931. - Checks for cancellation (KYCANC = 'CANCEL') set by AR931P. - AR931P: - Validates company selection (ALL or specific companies via KYALCO, KYCO1, KYCO2, KYCO3), job queue (KYJOBQ), and copies (KYCOPY). - Populates a company list (DCO) and uses GSCONT for default settings. - Passes validated parameters to AR931 via the data area (UDS). - AR931: - Uses the validated parameters to filter ARCONT records (e.g., specific companies if KYALCO = 'CO') and generate the report. - Runs in batch mode (as implied by B in the header) or interactively, based on KYJOBQ.

Summary

  • Process Overview: AR931 reads non-deleted records from the ARCONT file and generates a formatted A/R Control File Listing on the PRINT file. It prints headers (title, date, time, page number) and detail lines for each company, including GL numbers, journal numbers, finance charges, fiscal month, and aging bucket limits (0-30, 31-60, 61-90, 91-120 days, per revision JB01).
  • Business Rules: Includes only active (ACDEL ≠ 'D') records, formats aging by invoice date (0-30, 31-60, 61-90, 91-120, over 120 days), and uses parameters from AR931P for company selection and job control. Ensures consistent report formatting with headers and separators.
  • Files/Tables: ARCONT (input, A/R control data), PRINT (output, printer file).
  • External Programs: None called directly in AR931, but AR931P (input validation), GSGENIEC, and SCPROCP (system setup) are part of the OCL workflow.

If you need further details (e.g., specific report layout or additional context about GSCONT or AR931P interactions), please provide additional files or clarify the requirements, as some aspects (e.g., exact filtering logic) depend on the broader system context.