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:
- Program Initialization:
- 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.
- File Definitions:
FARCONT IP F 256 256 DISK
: DefinesARCONT
as the primary input file (256-byte records, disk-based), read sequentially.FPRINT O F 160 160 OF PRINTER
: DefinesPRINT
as the output file (160-byte records) for printing the report, with overflow indicatorOF
.
- Array Definitions:
E SEP 66 2
: Defines a 2-element arraySEP
with 66 bytes each, used for separator lines (likely asterisks, initialized in the program).E SEP2 16 2
: Defines a 2-element arraySEP2
with 16 bytes each, used for additional separator lines.
- Input Specifications:
IARCONT NS 01
: Defines the input record format forARCONT
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).
-
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.
-
Initial Setup (Calculation Specifications):
C N11 SETOF 15
: If indicator11
is off (no overflow), clears the overflow indicator15
.C N11 MOVE '* ' SEP
: Initializes theSEP
array with asterisks for separator lines.C N11 MOVE '* ' SEP2
: Initializes theSEP2
array with asterisks for additional separator lines.C N11 TIME TIMDAT 120
: Retrieves the system date and time intoTIMDAT
.C N11 MOVELTIMDAT TIME 60
: Moves the time portion toTIME
(6 bytes).C N11 MOVE TIMDAT DATE 60
: Moves the date portion toDATE
(6 bytes).-
C N11 SETON 1115
: Sets indicators11
(control break) and15
(overflow) to ensure headers are printed at the start. -
Report Generation (Output Specifications):
- 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 orAR931P
validation).
- Record Filtering: Skips records where
- 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).
-
Overflow Handling: The
OF
indicator triggers header reprinting when the page length (160 characters, likely with a standard line count) is exceeded. -
Program Flow:
- The RPG cycle automatically reads each
ARCONT
record, processes it, and writes toPRINT
until end-of-file. - Headers are printed at the start of the report and on page overflows.
- 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:
- Report Content:
- The report lists all non-deleted records from
ARCONT
(filtered implicitly or byAR931P
). -
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
).
- Company number (
-
Aging Buckets (Revision JB01):
- Per the revision log (dated 04/13/05), aging is based on invoice date rather than due date, as modified for PNC Bank.
- 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).
- 0-30 days (
-
This change aligns with financial reporting requirements for tracking receivables by invoice age.
-
Report Formatting:
- The report includes a header with the title, date, time, and page number.
- Separator lines (
SEP
,SEP2
) and column headers ensure readability. -
Fields are positioned at specific columns (e.g.,
ACCO
at 3,ACNAME
at 35) for consistent formatting. -
Record Filtering:
- Only non-deleted records (
ACDEL ≠ 'D'
) are included, ensuring the report reflects active companies. -
The
AR931P
program (called earlier in the OCL) validates company selections (ALL
or specific companies), soAR931
processes only the selected records. -
Output Control:
- The number of copies (
KYCOPY
) is set byAR931P
and passed via the OCL script. - The report can be run interactively or submitted to a job queue (
KYJOBQ
), as determined byAR931P
and the OCL script.
Tables/Files Used¶
- ARCONT:
- Type: Primary input file (disk, 256 bytes).
- Purpose: Stores Accounts Receivable control data, including company details, GL numbers, journal numbers, finance charges, and aging bucket limits.
-
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.
-
PRINT:
- Type: Output file (printer, 160 bytes).
- 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 controlAR931
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 theARCONT
file and generates a formatted A/R Control File Listing on thePRINT
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 fromAR931P
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
, butAR931P
(input validation),GSGENIEC
, andSCPROCP
(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.