Skip to content

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

  1. File and Data Structure Definitions:
  2. 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.
  3. Array Definition (E-Spec):
    • MSG is an array to store five error messages, each 35 characters long, used for displaying validation errors.
  4. 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), and CURLST (1 char).
    • Format 09: Similar fields but mapped via a data structure (UDS) with slightly different positions.
  5. Output Specifications (O-Spec):

    • Defines the output format AP765PS1 for the screen, writing fields like HEAD1, HEAD2, HEAD3, ID#, ENTAMT, TYPE, CURLST, and MSGE (error message).
  6. Calculation Specifications (C-Spec):

  7. 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.
  8. 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.
  9. 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.
  10. Screen Format 01 Handling:
    • Line 0043: If format 01 is active, execute the subroutine SUBSC1 for input validation.
  11. 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 to ENDSC1.
    • 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 to ENDSC1.
    • 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 to ENDSC1.
    • 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 to ENDSC1.
    • 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 to ENDSC1.
    • 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.
  12. 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.
  13. Output Processing:

  14. Lines 0079–0088: Write the AP765PS1 format to the screen, including all input fields and the error message (MSGE) if applicable. The 81 indicator controls whether this is the first time the screen is displayed.

Business Rules

  1. Mandatory Fields:
  2. HEAD1, HEAD2, and ID# cannot be blank. If any are blank, an error message is displayed, and the screen is redisplayed.
  3. Valid Values for TYPE:
  4. Must be one of 'D' (Dividend), 'I' (Interest), 'M' (Miscellaneous), or 'N' (Nonemployee Compensation). Invalid values trigger an error.
  5. Valid Values for CURLST:
  6. Must be 'C' (Current) or 'L' (Last). Invalid values trigger an error.
  7. Error Handling:
  8. Validation errors set specific indicators (91–96) to highlight the erroneous field and display a corresponding message from the MSG array.
  9. Indicator 81 controls screen redisplay when validation fails.
  10. Program Exit:
  11. Pressing a function key (KG) sets the LR indicator and exits the program.
  12. 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:
    1. "FIRST HEADING CANNOT BE BLANK"
    2. "SECOND HEADING CANNOT BE BLANK"
    3. "ID# CANNOT BE BLANK - TRY AGAIN!"
    4. "ENTER I-INT, D-DIV, M-MISC, N-NEC"
    5. "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.