AR745P RPGLE
The provided document, AR745P.rpgle.txt, is an RPGLE (RPG IV) program used in an IBM midrange system (e.g., AS/400 or iSeries) to process Electronic Funds Transfer (EFT) customer receivables. It is called by the OCL script AR745P.ocl36.txt. Below, I’ll explain the process steps, business rules, tables used, and external programs called, focusing on clarity and conciseness while adhering to the provided guidelines.
Process Steps of the RPGLE Program¶
The AR745P program prompts for a date range and other parameters to select EFT customer receivables, validates input, and prepares data for further processing. The steps are as follows:
- Program Initialization:
- Header Specifications:
H DFTACTGRP(*NO): Runs in a non-default activation group for better resource management.H FIXNBR(*ZONED:*INPUTPACKED): Converts zoned and packed numeric fields for compatibility.H DFTNAME(AR745P): Specifies the default program name.
- File Declarations:
FAR745PD CF E WORKSTN HANDLER('PROFOUNDUI(HANDLER)'): Defines an interactive workstation file (display file) for user input/output, using the Profound UI handler.FARCONT IF F 256 2AIDISK KEYLOC(2): Input file for accounts receivable control data, keyed by company number (position 2).FARCUST IF F 384 8AIDISK KEYLOC(2): Input file for customer master data, keyed by company and customer number.FGSCONT IF F 512 2AIDISK KEYLOC(2): Input file for additional control data, keyed by company number.
-
Data Structures and Variables:
MSG: Array of 11 error messages (e.g., "INVALID COMPANY #", "ENTER VALID 'FROM' DATE").UDS: Data structure for job control fields (e.g.,KYCO1for company number,KYFRDTfor from-date,KYJOBQfor job queue flag).- Fields like
Y2KCEN(century) andY2KCMP(comparison year) handle Y2K date logic.
-
Workstation File Processing:
- If
QSCTL(control field) is blank:- Sets
*IN01to display the input screen (AR745PFM). - Sets
QSCTLto 'R' to indicate read mode.
- Sets
-
Otherwise:
- Reads the display file (
AR745PFM). - If the last record is read (
LRindicator), the program terminates (RETURN).
- Reads the display file (
-
Indicator Initialization:
- Resets indicators
*IN51to*IN57and*IN90toOFFto clear error flags. -
These indicators control error messages and screen behavior.
-
Cancel Check:
-
If
*INKG(cancel key, e.g., F3) is pressed:- Clears
*IN01, sets*INLR(last record) to terminate, and setsKYCANCto 'CANCEL'. - Jumps to the
ENDtag to exit the program.
- Clears
-
Input Processing:
- If
*IN10isONand*IN11isOFF, executes theEDITsubroutine to validate input. - If
*IN10isOFFand*IN11isOFF, executes theONETIMsubroutine to set default values. -
If both
*IN10and*IN11areON, sets*INLRto terminate the program. -
Write to Display File:
- If
*IN11isOFF, writes to the display file (AR745PFM) to prompt for input or display errors. -
Jumps to the
ENDtag to continue the loop. -
EDIT Subroutine:
-
Validates user input:
- Company Number (
KYCO1): - Chains to
ARCONTusingKYCO1. - If not found (
*IN99), sets error message ("INVALID COMPANY #"),*IN51, and*IN90, then exits toENDEDT. - Customer Number (
KYCUST): - If non-zero, chains to
ARCUSTusingKYCO1andKYCUST. - If not found (
*IN99), sets error message ("INVALID CUSTOMER #"),*IN57, and*IN90. - If found but
AREFTis not 'Y', sets error message ("CUSTOMER IS NOT AN EFT PARTICIPANT"),*IN57, and*IN90. - Date Validation:
- Validates
KYFRDT(from-date),KYTODT(to-date), andKYSEDT(settlement date) using theDTEDITsubroutine. - If invalid, sets appropriate error messages (e.g., "ENTER VALID 'FROM' DATE"), indicators (
*IN52,*IN53,*IN54,*IN90), and exits toENDEDT. - Date Conversion:
- Converts
KYFRDT,KYTODT, andKYSEDTto YYMMDD format (KYFYMD,KYTYMD,KYSYMD) by multiplying by 10000.01. - Handles Y2K logic by checking year fields (
KYFRYY,KYTOYY,KYSEYY) againstY2KCMPto determine the century (ICN). - Builds 8-digit dates (
KFCYMD,KTCYMD,KSCYMD) with century and YYMMDD. - Batch and Job Queue Flags:
- Validates
KYBATCandKYJOBQ(must be 'Y', 'N', or blank). - If invalid, sets error message ("ENTER Y, N OR BLANK"),
*IN56or*IN55, and*IN90. - Copy Count:
- If
KYCOPYis zero, sets it to 1. - Sets
*IN11to indicate validation is complete.
- Company Number (
-
ONETIM Subroutine:
-
Initializes default values on first run:
- Chains to
GSCONTwith key '00' to retrieve a default company number (GXCONO). - Sets
KYCO1toGXCONO(if non-zero). - Sets
KYJOBQandKYBATCto 'N',KYCOPYto 1, andKYFRDT,KYTODT,KYUPDT,KYCUSTto zero. - Sets
*IN10and*IN52toON,*IN20toOFF.
- Chains to
-
DTEDIT Subroutine:
- Validates dates in MMDDYY format:
- Breaks down
MMDDYYinto$MONTH,$DAY, and$YR. - Checks if
$MONTHis valid (1–12). - For February (
$MONTH = 2): - Determines leap year by checking if
$YRis divisible by 4 (or 400 for century years). - Validates
$DAY(≤29 for leap year, ≤28 for non-leap year). - For other months:
- Checks
$DAY(≤30 for April, June, September, November; ≤31 for others). - Sets
*IN79if any validation fails and exits to@ENDDT.
- Breaks down
Business Rules¶
- Input Validation:
- Company number (
KYCO1) must exist inARCONT. - Customer number (
KYCUST), if provided, must exist inARCUSTand haveAREFT = 'Y'(EFT participant). - Dates (
KYFRDT,KYTODT,KYSEDT) must be valid MMDDYY format, with proper month, day, and leap year checks. KYBATCandKYJOBQmust be 'Y', 'N', or blank.-
KYCOPYdefaults to 1 if zero. -
Date Handling:
- Converts 6-digit MMDDYY dates to 8-digit CYYMMDD format for Y2K compliance.
-
Uses
Y2KCMPandY2KCENto determine the century (e.g., 19 or 20) based on year comparison. -
Error Handling:
- Displays specific error messages from the
MSGarray for invalid inputs (e.g., company, customer, dates, flags). -
Sets indicators (
*IN51–*IN57,*IN90) to highlight errors on the screen. -
Program Flow:
- On first run, initializes defaults via
ONETIM. - Validates input via
EDITuntil valid or cancelled. - Terminates if cancel key is pressed or validation completes successfully.
Tables (Files) Used¶
- AR745PD:
- Type: Workstation (display file)
- Purpose: Interactive input/output for user prompts (e.g., company, dates, job queue).
-
Handler: Profound UI (
PROFOUNDUI(HANDLER)). -
ARCONT:
- Type: Input file (disk)
- Record Length: 256 bytes
- Key: Company number (position 2)
- Fields:
ACDEL(delete flag),ACCO(company number),ACNAME(company name). -
Purpose: Stores accounts receivable control data.
-
ARCUST:
- Type: Input file (disk)
- Record Length: 384 bytes
- Key: Company and customer number (position 2)
- Fields:
ARDEL(delete flag),ARCO(company number),ARCUSN(customer number),ARNAME(customer name),AREFT(EFT participant flag). -
Purpose: Stores customer master data.
-
GSCONT:
- Type: Input file (disk)
- Record Length: 512 bytes
- Key: Company number (position 2)
- Fields:
GXDEL(delete flag),GXCONO(company number). - Purpose: Stores additional control data (e.g., default company number).
External Programs Called¶
- None:
- The RPGLE program does not explicitly call external programs (e.g., via
CALLoperation). - It interacts with the display file using the Profound UI handler, but this is a system-level interface, not a program call.
Summary¶
The AR745P RPGLE program, called by the OCL script, prompts users for EFT processing parameters (company, customer, date range, job queue, batch flag, copy count), validates input, and prepares data for EFT report generation. It enforces strict validation rules for company, customer, and dates, handles Y2K date conversions, and provides error feedback via a display file. The program uses ARCONT, ARCUST, and GSCONT for data validation and AR745PD for user interaction.
If you need further details (e.g., specific field formats, additional context from the OCL script, or analysis of the Profound UI handler), let me know!