AP765P RPG36
The RPG36 program AP765P
is designed to handle prompts for a Vendor 1099 form, likely used for tax reporting purposes. It defines a screen interface to collect and validate input data related to vendor information. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.
Process Steps¶
- File and Data Structure Definitions:
- File Definition (F-Spec):
SCREEN
is defined as a workstation file (WORKSTN
) with a record length of 512 bytes, used for interactive screen input/output.
- Array Definition (E-Spec):
MSG
is an array to store five error messages, each 35 characters long, used for displaying validation errors.
- Input Specifications (I-Spec):
- Two formats are defined for the
SCREEN
file: - Format 01: Input fields include
HEAD1
(30 chars),HEAD2
(30 chars),HEAD3
(30 chars),ID#
(10 chars),ENTAMT
(8 chars, 2 decimal places),TYPE
(1 char), andCURLST
(1 char). - Format 09: Similar fields but mapped via a data structure (
UDS
) with slightly different positions.
- Two formats are defined for the
-
Output Specifications (O-Spec):
- Defines the output format
AP765PS1
for the screen, writing fields likeHEAD1
,HEAD2
,HEAD3
,ID#
,ENTAMT
,TYPE
,CURLST
, andMSGE
(error message).
- Defines the output format
-
Calculation Specifications (C-Spec):
- Initialization:
- Lines 0029–0031: Reset indicators 81, 90, 91, 92, 93, 94, 95, and 96 to off.
- Line 0032: Clear the
MSGE
field to blanks.
- Key Processing (KG):
- If the
KG
(likely a function key like F3 or Cancel) is pressed: - Line 0034: Turn off indicator 81.
- Line 0035: Turn on indicators U1 and LR (Last Record, typically to exit).
- Line 0036: Branch to the
END
tag to terminate the program.
- If the
- Screen Format 09 Handling:
- Line 0040: If format 09 is active (likely a specific screen state or input), set indicators 81 and 94, then branch to
END
.
- Line 0040: If format 09 is active (likely a specific screen state or input), set indicators 81 and 94, then branch to
- Screen Format 01 Handling:
- Line 0043: If format 01 is active, execute the subroutine
SUBSC1
for input validation.
- Line 0043: If format 01 is active, execute the subroutine
- Subroutine SUBSC1 (Lines 0047–0077):
- Validates input fields in the following order, setting error indicators and messages if validation fails:
- HEAD1 (Line 0049–0052): Check if blank. If blank, set indicators 81 and 91, move message 1 ("FIRST HEADING CANNOT BE BLANK") to
MSGE
, and branch toENDSC1
. - HEAD2 (Line 0054–0057): Check if blank. If blank, set indicators 81 and 92, move message 2 ("SECOND HEADING CANNOT BE BLANK") to
MSGE
, and branch toENDSC1
. - ID# (Line 0059–0062): Check if blank. If blank, set indicators 81 and 93, move message 3 ("ID# CANNOT BE BLANK - TRY AGAIN!") to
MSGE
, and branch toENDSC1
. - TYPE (Line 0064–0069): Check if value is one of 'D' (Dividend), 'I' (Interest), 'M' (Miscellaneous), or 'N' (Nonemployee Compensation). If not, set indicators 81 and 95, move message 4 ("ENTER I-INT, D-DIV, M-MISC, N-NEC") to
MSGE
, and branch toENDSC1
. - CURLST (Line 0071–0075): Check if value is 'C' (Current) or 'L' (Last). If not, set indicators 81 and 96, move message 5 ("ENTER 'C'-CURR OR 'L'-LAST") to
MSGE
, and branch toENDSC1
. - If any validation fails, the program branches to
ENDSC1
, which ends the subroutine and returns control to the main logic, typically redisplaying the screen with the error message.
-
Program Termination:
- Line 0045: The
END
tag marks the point where the program terminates after processing or if a function key or validation triggers an exit.
- Line 0045: The
-
Output Processing:
- Lines 0079–0088: Write the
AP765PS1
format to the screen, including all input fields and the error message (MSGE
) if applicable. The81
indicator controls whether this is the first time the screen is displayed.
Business Rules¶
- Mandatory Fields:
HEAD1
,HEAD2
, andID#
cannot be blank. If any are blank, an error message is displayed, and the screen is redisplayed.- Valid Values for TYPE:
- Must be one of 'D' (Dividend), 'I' (Interest), 'M' (Miscellaneous), or 'N' (Nonemployee Compensation). Invalid values trigger an error.
- Valid Values for CURLST:
- Must be 'C' (Current) or 'L' (Last). Invalid values trigger an error.
- Error Handling:
- Validation errors set specific indicators (91–96) to highlight the erroneous field and display a corresponding message from the
MSG
array. - Indicator 81 controls screen redisplay when validation fails.
- Program Exit:
- Pressing a function key (
KG
) sets theLR
indicator and exits the program. - Format 09 processing also leads to an immediate exit with indicators 81 and 94 set.
Tables Used¶
- MSG Array:
- An array defined in the E-Spec (line 0009) to store five error messages, each 35 characters long, used for validation feedback:
- "FIRST HEADING CANNOT BE BLANK"
- "SECOND HEADING CANNOT BE BLANK"
- "ID# CANNOT BE BLANK - TRY AGAIN!"
- "ENTER I-INT, D-DIV, M-MISC, N-NEC"
- "ENTER 'C'-CURR OR 'L'-LAST"
- No database files are explicitly defined in the program, indicating that this program focuses on screen input validation rather than database interaction.
External Programs Called¶
- None:
- The program does not explicitly call any external programs (no
CALL
statements or references to other programs). - It is invoked from a main OCL (Operation Control Language) script, as mentioned, but no details about the OCL or other programs are provided in the code.
Summary¶
The AP765P
program is a screen-based input validation program for a Vendor 1099 form. It:
- Collects input for fields like headings (HEAD1
, HEAD2
, HEAD3
), vendor ID (ID#
), amount (ENTAMT
), type (TYPE
), and current/last indicator (CURLST
).
- Validates these fields to ensure they are not blank (for headings and ID#) and contain valid values (for TYPE
and CURLST
).
- Displays error messages from the MSG
array if validation fails.
- Uses a workstation file (SCREEN
) for interactive input/output.
- Exits on function key press or specific screen format (09) processing.
- Does not interact with database files or call external programs.
This program is likely part of a larger system where the validated data is passed back to the calling OCL for further processing, such as generating 1099 forms for tax reporting.