AR156P RPGLE
The provided document is an RPGLE (RPG IV) program named AR156P.rpgle, which is called by the AR156.ocl36 OCL script. This program is designed to prompt for and validate the selection of a date for EFT (Electronic Funds Transfer) posting table creation, ensuring the input data (company number and batch date) is valid before proceeding with EFT file processing. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.
Process Steps of the AR156P.rpgle Program¶
- Program Initialization:
- The program uses the
DFTACTGRP(*NO)directive, indicating it runs in a non-default activation group, allowing for better control over resources. - The
FIXNBR(*ZONED:*INPUTPACKED)option ensures proper handling of zoned and packed numeric data during input. - The program defines a workstation file
AR156PD(likely a display file for user interaction) using the Profound UI handler for modernized user interfaces. -
Data structures and variables are defined:
filenm: An 8-character field to construct a file name.kyco: A 2-digit company number (positions 101-102).kysldt: A 6-digit selected date (positions 103-108).status: A 1-character field (position 109) to indicate validation status ('Y' for valid, 'N' for invalid).kyupdt: A 6-digit update date (positions 110-115).p$fgrp: A 1-character file group identifier (position 501).y2kcenandy2kcmp: Year 2000-related fields for century and company (positions 509-512).msg: An array of three 40-character error messages loaded from compile-time data.
-
Workstation File Read and Initial Logic:
- The program checks the
qsctlfield (likely a control flag):- If
qsctlis blank, it sets indicator*IN09to '1' (first-time display),*IN01to '0', and setsqsctlto 'R' (read mode). - Otherwise, it sets
*IN09to '0',*IN01to '1', reads theAR156PDdisplay file, and returns if the last record is read (lrindicator).
- If
- Indicators 50-55, 20, and 81 are reset to off, ensuring a clean state for error handling and screen output.
-
The
msg35field (35 characters) is cleared to blanks. -
Handle Function Key (F3/F12 Exit):
-
If the function key indicator
*INKGis on (likely F3 or F12 for exit), the program:- Sets
*IN01to off (disables further input processing). - Sets
*INU8and*INLRto on (signals program termination). - Jumps to the
endtag to exit.
- Sets
-
First-Time Processing (One-Time Setup):
-
If
*IN09is on (first-time display), theonetimsubroutine is executed:- Chains to the
GSCONTfile with key '00' to retrieve a default company number. - If the record is found (
*IN99off) andGXCONO(company number) is non-zero, it movesGXCONOtokyco. - Sets
*IN81to on (indicating screen output is needed) and clearsmsg40(a 40-character message field). - Jumps to the
endtag to display the screen.
- Chains to the
-
Input Validation (Edit Subroutine):
-
If
*IN01is on (input received from the screen), theeditsubroutine is executed:- Resets indicators 20, 30-41, and 90 to off, clearing previous error states.
- Validates the company number (
kyco): - Chains to the
ARCONTfile usingkycoas the key. - If no record is found (
*IN20on), sets error indicators*IN81and*IN90, moves the first error message ("INVALID COMPANY #") tomsg40, and jumps toendedt. - Validates the batch create date (
kyupdt): - Compares
kyupdtto zero. - If zero (
*IN20on), sets error indicators*IN81and*IN90, moves the second error message ("MUST ENTER BATCH CREATE DATE") tomsg40, and jumps toendedt. - Checks if the selected date table exists:
- Constructs a file name in
filenmby combiningp$fgrp(file group) and 'E' withkyupdt(e.g.,GE+ date). - Calls the external program
AR135TC, passingfilenmandstatusas parameters to verify the file's existence. - If
statusis 'N' (file does not exist), sets error indicators*IN81,*IN20, and*IN90, moves the third error message ("FILE WITH DATE SELECTED DOES NOT EXIST") tomsg40, and jumps toendedt. - If all validations pass, sets
statusto 'Y' (valid input).
-
Screen Output and Termination:
- If no errors are detected (
*IN81off), sets*INLRto on to terminate the program. - If errors are detected (
*IN81on), writes to theAR156PDdisplay file to show the error message (msg40) and input fields (kyco,kyupdt). - The program ends at the
endtag.
Business Rules¶
- Company Number Validation:
- The user must enter a valid company number (
kyco) that exists in theARCONTfile. -
If invalid, the program displays "INVALID COMPANY #" and prompts the user to correct the input.
-
Batch Create Date Validation:
- The user must enter a non-zero batch create date (
kyupdt). -
If zero or blank, the program displays "MUST ENTER BATCH CREATE DATE" and prompts for correction.
-
File Existence Check:
- The program constructs a file name based on the file group (
p$fgrp) and the batch create date (kyupdt) and checks if the corresponding EFT data file exists. -
If the file does not exist, the program displays "FILE WITH DATE SELECTED DOES NOT EXIST" and prompts for correction.
-
First-Time Display:
-
On the first screen display, the program attempts to retrieve a default company number from the
GSCONTfile (key '00') to prefill thekycofield. -
Error Handling and User Interaction:
- The program uses a display file (
AR156PD) to interact with the user, showing error messages and allowing input corrections. -
If the user presses a function key to exit (e.g., F3/F12), the program terminates without further processing.
-
Status Output:
- If all validations pass, the program sets the
statusfield to 'Y' to indicate successful validation. - If any validation fails,
statusis set to 'N', and an error message is displayed.
Tables (Files) Used¶
- AR156PD (
CF- Workstation file): - A display file used for user interaction, allowing input of company number (
kyco) and batch create date (kyupdt) and displaying error messages (msg40). -
Uses the Profound UI handler for modernized UI.
-
ARCONT (
IF- Input file): -
A 256-byte file with a 2-byte key (starting at position 2) used to validate the company number (
kyco). -
GSCONT (
IF- Input file): - A 512-byte file with a 2-byte key (starting at position 2) used to retrieve a default company number (
GXCONO) for the first-time display.
External Programs Called¶
- AR135TC:
- Called to check the existence of the EFT data file specified by
filenm. - Parameters:
filenm(file name to check) andstatus(output indicating 'Y' for exists or 'N' for does not exist).
Summary¶
The AR156P program is a user interface and validation module that prompts for and validates the company number and batch create date for EFT posting table creation. It ensures the company number exists in ARCONT, the batch date is non-zero, and the corresponding EFT data file exists. The program interacts with the user via a display file (AR156PD), retrieves default data from GSCONT, and calls AR135TC to verify file existence. Upon successful validation, it sets the status to 'Y'; otherwise, it displays error messages and allows corrections. The program is a critical step in the EFT file creation process orchestrated by the AR156.ocl36 script.
Summary of AR135TC.clp¶
The AR135TC.clp is a CLP (Control Language Program) used in the EFT (Electronic Funds Transfer) draft process to check the existence of a specified file in the QS36F library. Below is a brief summary of its functionality:
- Purpose: Validates whether a file exists in the
QS36Flibrary and sets a status indicator accordingly. - Parameters:
&FILE: An 8-character input parameter specifying the name of the file to check.&STATUS: A 1-character output parameter indicating the result ('Y' if the file exists, 'N' if it does not).- Process:
- Declares two variables:
&FILE(8 characters) and&STATUS(1 character). - Uses the
CHKOBJcommand to check if the file specified by&FILEexists in theQS36Flibrary with object type*FILE. - If the file does not exist (message ID
CPF9801is caught viaMONMSG), sets&STATUSto 'N' and jumps to theENDlabel. - If the file exists, sets
&STATUSto 'Y'. - Ends the program with
ENDPGM. - Business Rule: The program ensures that the EFT process only proceeds if the required data file exists, preventing errors in downstream processing.
This program is called by AR156P.rpgle to verify the existence of an EFT data file before proceeding with further validation and processing in the EFT workflow.