Skip to content

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:

  1. Program Initialization:
  2. 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.
  3. 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.
  4. 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., KYCO1 for company number, KYFRDT for from-date, KYJOBQ for job queue flag).
    • Fields like Y2KCEN (century) and Y2KCMP (comparison year) handle Y2K date logic.
  5. Workstation File Processing:

  6. If QSCTL (control field) is blank:
    • Sets *IN01 to display the input screen (AR745PFM).
    • Sets QSCTL to 'R' to indicate read mode.
  7. Otherwise:

    • Reads the display file (AR745PFM).
    • If the last record is read (LR indicator), the program terminates (RETURN).
  8. Indicator Initialization:

  9. Resets indicators *IN51 to *IN57 and *IN90 to OFF to clear error flags.
  10. These indicators control error messages and screen behavior.

  11. Cancel Check:

  12. If *INKG (cancel key, e.g., F3) is pressed:

    • Clears *IN01, sets *INLR (last record) to terminate, and sets KYCANC to 'CANCEL'.
    • Jumps to the END tag to exit the program.
  13. Input Processing:

  14. If *IN10 is ON and *IN11 is OFF, executes the EDIT subroutine to validate input.
  15. If *IN10 is OFF and *IN11 is OFF, executes the ONETIM subroutine to set default values.
  16. If both *IN10 and *IN11 are ON, sets *INLR to terminate the program.

  17. Write to Display File:

  18. If *IN11 is OFF, writes to the display file (AR745PFM) to prompt for input or display errors.
  19. Jumps to the END tag to continue the loop.

  20. EDIT Subroutine:

  21. Validates user input:

    • Company Number (KYCO1):
    • Chains to ARCONT using KYCO1.
    • If not found (*IN99), sets error message ("INVALID COMPANY #"), *IN51, and *IN90, then exits to ENDEDT.
    • Customer Number (KYCUST):
    • If non-zero, chains to ARCUST using KYCO1 and KYCUST.
    • If not found (*IN99), sets error message ("INVALID CUSTOMER #"), *IN57, and *IN90.
    • If found but AREFT is not 'Y', sets error message ("CUSTOMER IS NOT AN EFT PARTICIPANT"), *IN57, and *IN90.
    • Date Validation:
    • Validates KYFRDT (from-date), KYTODT (to-date), and KYSEDT (settlement date) using the DTEDIT subroutine.
    • If invalid, sets appropriate error messages (e.g., "ENTER VALID 'FROM' DATE"), indicators (*IN52, *IN53, *IN54, *IN90), and exits to ENDEDT.
    • Date Conversion:
    • Converts KYFRDT, KYTODT, and KYSEDT to YYMMDD format (KYFYMD, KYTYMD, KYSYMD) by multiplying by 10000.01.
    • Handles Y2K logic by checking year fields (KYFRYY, KYTOYY, KYSEYY) against Y2KCMP to determine the century (ICN).
    • Builds 8-digit dates (KFCYMD, KTCYMD, KSCYMD) with century and YYMMDD.
    • Batch and Job Queue Flags:
    • Validates KYBATC and KYJOBQ (must be 'Y', 'N', or blank).
    • If invalid, sets error message ("ENTER Y, N OR BLANK"), *IN56 or *IN55, and *IN90.
    • Copy Count:
    • If KYCOPY is zero, sets it to 1.
    • Sets *IN11 to indicate validation is complete.
  22. ONETIM Subroutine:

  23. Initializes default values on first run:

    • Chains to GSCONT with key '00' to retrieve a default company number (GXCONO).
    • Sets KYCO1 to GXCONO (if non-zero).
    • Sets KYJOBQ and KYBATC to 'N', KYCOPY to 1, and KYFRDT, KYTODT, KYUPDT, KYCUST to zero.
    • Sets *IN10 and *IN52 to ON, *IN20 to OFF.
  24. DTEDIT Subroutine:

  25. Validates dates in MMDDYY format:
    • Breaks down MMDDYY into $MONTH, $DAY, and $YR.
    • Checks if $MONTH is valid (1–12).
    • For February ($MONTH = 2):
    • Determines leap year by checking if $YR is 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 *IN79 if any validation fails and exits to @ENDDT.

Business Rules

  1. Input Validation:
  2. Company number (KYCO1) must exist in ARCONT.
  3. Customer number (KYCUST), if provided, must exist in ARCUST and have AREFT = 'Y' (EFT participant).
  4. Dates (KYFRDT, KYTODT, KYSEDT) must be valid MMDDYY format, with proper month, day, and leap year checks.
  5. KYBATC and KYJOBQ must be 'Y', 'N', or blank.
  6. KYCOPY defaults to 1 if zero.

  7. Date Handling:

  8. Converts 6-digit MMDDYY dates to 8-digit CYYMMDD format for Y2K compliance.
  9. Uses Y2KCMP and Y2KCEN to determine the century (e.g., 19 or 20) based on year comparison.

  10. Error Handling:

  11. Displays specific error messages from the MSG array for invalid inputs (e.g., company, customer, dates, flags).
  12. Sets indicators (*IN51*IN57, *IN90) to highlight errors on the screen.

  13. Program Flow:

  14. On first run, initializes defaults via ONETIM.
  15. Validates input via EDIT until valid or cancelled.
  16. Terminates if cancel key is pressed or validation completes successfully.

Tables (Files) Used

  1. AR745PD:
  2. Type: Workstation (display file)
  3. Purpose: Interactive input/output for user prompts (e.g., company, dates, job queue).
  4. Handler: Profound UI (PROFOUNDUI(HANDLER)).

  5. ARCONT:

  6. Type: Input file (disk)
  7. Record Length: 256 bytes
  8. Key: Company number (position 2)
  9. Fields: ACDEL (delete flag), ACCO (company number), ACNAME (company name).
  10. Purpose: Stores accounts receivable control data.

  11. ARCUST:

  12. Type: Input file (disk)
  13. Record Length: 384 bytes
  14. Key: Company and customer number (position 2)
  15. Fields: ARDEL (delete flag), ARCO (company number), ARCUSN (customer number), ARNAME (customer name), AREFT (EFT participant flag).
  16. Purpose: Stores customer master data.

  17. GSCONT:

  18. Type: Input file (disk)
  19. Record Length: 512 bytes
  20. Key: Company number (position 2)
  21. Fields: GXDEL (delete flag), GXCONO (company number).
  22. 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 CALL operation).
  • 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!