Skip to content

AP765N OCL

Explanation of the Process Steps and Business Rules in the OCL Program (AP765N.ocl36.txt)

The OCL (Operation Control Language) program AP765N.ocl36.txt is an alternative path for processing vendor 1099 forms on an IBM System/36 or AS/400 system, called conditionally from AP765P.ocl36.txt when ?L'110,1'? is N instead of M. It is nearly identical to AP765.ocl36.txt but invokes AP765N instead of AP765 for printing the 1099 forms, suggesting a variation in the printing process (likely for 1099-NEC forms instead of 1099-MISC). Below is a detailed explanation of the process steps, business rules, tables/files used, and external programs called.


Process Steps

  1. Program Initialization:
  2. GSY2K: Invokes a system routine to ensure Year 2000 compliance for date handling.
  3. Parameters:
    • ?10?: Specifies the four-digit year for the 1099 file (e.g., 2012).
    • ?13?: Specifies the 1099 file name (e.g., APVN2012), containing vendor data.
  4. Programmer Note: The file APVNYYYY (e.g., APVN2012) is created during the period-end process (AP300) and is a snapshot of the GAPVEND file before monthly and yearly totals are cleared.

  5. Delete Temporary File (if exists):

  6. IF DATAF1-?9?AP766 DELETE ?9?AP766,F1: Checks if the temporary file ?9?AP766 (e.g., XXAP766, where ?9? is a prefix) exists. If it does, the file is deleted to ensure a clean start for processing.

  7. Sort Input File:

  8. LOAD #GSORT: Loads the system sort utility (#GSORT).
  9. Input File:
    • FILE NAME-INPUT,LABEL-?13?,DISP-SHR: Specifies the input file as ?13? (e.g., APVN2012), opened in shared mode (DISP-SHR).
  10. Output File:
    • FILE NAME-OUTPUT,LABEL-?9?AP765S,RECORDS-999000,EXTEND-999000,RETAIN-J: Creates a sorted output file named ?9?AP765S (e.g., XXAP765S), with a capacity of 999,000 records, extendable by another 999,000, and retained as a job file (RETAIN-J).
  11. Sort Specifications:
    • HSORTA 22A 3X N: Defines an ascending sort (A) on a 22-character field starting at position 3, with no sequence checking (N).
    • O C 264EQC: Includes records where the field at position 264 equals a constant value (likely a flag or type indicator).
    • I*: Includes all records.
    • I C 1NECD: Includes records where position 1 equals N, E, C, or D (likely 1099 types: Non-Employee Compensation, etc.).
    • IAC 264 264EQC?L'110,1'?: Conditionally includes records based on the value of ?L'110,1'? (in this case, N for 1099-NEC).
    • Sort Fields:
    • FNC 264 264: Sorts on the 1099 type field (position 264, 1 character).
    • FNC 4 8: Sorts on the vendor field (positions 4-8, 5 characters).
    • FNC 2 3: Sorts on the company field (positions 2-3, 2 characters).
  12. RUN: Executes the sort, producing the sorted file ?9?AP765S.
  13. Purpose: Sorts vendor data by 1099 type (likely filtered for N), vendor, and company to organize records for processing.

  14. Process Sorted Data:

  15. LOAD AP766: Loads the program AP766 (an RPG program for data processing, as described in AP766.rpg36.txt).
  16. Files Used:
    • FILE NAME-APVEND,LABEL-?13?,DISP-SHR: Input file ?13? (e.g., APVN2012), shared mode.
    • FILE NAME-AP765S,LABEL-?9?AP765S: Sorted input file ?9?AP765S from the sort step.
    • FILE NAME-AP766,LABEL-?9?AP766,RECORDS-1000,EXTEND-500: Output file ?9?AP766, with an initial capacity of 1,000 records, extendable by 500.
    • FILE NAME-PA1099X,LABEL-?9?PA1099X,DISP-SHR: Cross-reference or configuration file ?9?PA1099X, opened in shared mode.
  17. RUN: Executes AP766, which processes the sorted vendor data and produces the output file ?9?AP766.
  18. Purpose: Consolidates vendor records (one per vendor) and prepares data for printing, likely focusing on 1099-NEC forms due to ?L'110,1'? being N.

  19. Print 1099 Forms:

  20. LOAD AP765N: Loads the program AP765N (an RPG program for printing, distinct from AP765).
  21. File Used:
    • FILE NAME-AP766,LABEL-?9?AP766,DISP-SHR: Input file ?9?AP766, the processed data from AP766, shared mode.
  22. Printer Configuration:
    • OVRPRTF FILE(AP1099) FORMTYPE(1099) CPI(10) LPI(6): Overrides printer file AP1099 to use form type 1099, with 10 characters per inch (CPI) and 6 lines per inch (LPI).
    • The commented line PRINTER NAME-AP1099,FORMSNO-1099,ALIGN-YES,LPI-6,CPI-10 suggests similar settings for older syntax compatibility.
  23. RUN: Executes AP765N, which prints the 1099 forms (likely 1099-NEC) using the data in ?9?AP766.
  24. Purpose: Generates the final 1099 forms, tailored for the N type (Non-Employee Compensation).

  25. Cleanup Temporary File:

  26. IF DATAF1-?9?AP766 DELETE ?9?AP766,F1: After processing, checks if the temporary file ?9?AP766 exists and deletes it to clean up.

Business Rules

  1. Input File Validation:
  2. The input file ?13? (e.g., APVN2012) must exist and contain vendor data from the period-end process (AP300).
  3. It is a snapshot of GAPVEND before monthly and yearly totals are cleared.

  4. Data Sorting:

  5. Vendor records are sorted by:
    • 1099 type (position 264, likely N for Non-Employee Compensation due to ?L'110,1'?).
    • Vendor code (positions 4-8).
    • Company code (positions 2-3).
  6. Only records matching specific 1099 types (N, E, C, D) or the value in ?L'110,1'? (N) are included.

  7. Temporary Files:

  8. Temporary files ?9?AP765S and ?9?AP766 are created during processing and deleted afterward to avoid conflicts in subsequent runs.
  9. ?9?AP765S is a sorted version of the input file.
  10. ?9?AP766 contains processed data ready for printing.

  11. File Retention:

  12. The sorted file ?9?AP765S is retained as a job file (RETAIN-J), ensuring it persists for the duration of the job.

  13. Printer Configuration:

  14. The 1099 forms are printed with specific formatting (10 CPI, 6 LPI) on form type 1099, ensuring IRS compliance, likely for 1099-NEC forms.

  15. Year 2000 Compliance:

  16. The GSY2K routine ensures proper date handling for the year specified in ?10?.

  17. Conditional Path:

  18. This program is called when ?L'110,1'? is N in AP765P.ocl36.txt, indicating a focus on 1099-NEC forms rather than 1099-MISC (handled by AP765.ocl36.txt).

Tables/Files Used

  1. Input File:
  2. ?13? (e.g., APVN2012): The vendor file created by AP300, a snapshot of GAPVEND containing vendor data. Used in the sort and processing steps.

  3. Temporary Files:

  4. ?9?AP765S (e.g., XXAP765S): Sorted output file created by #GSORT, used as input for AP766.
  5. ?9?AP766 (e.g., XXAP766): Processed output file created by AP766, used as input for AP765N to print 1099 forms.

  6. Cross-Reference File:

  7. ?9?PA1099X (e.g., XXPA1099X): A configuration or cross-reference file used by AP766, opened in shared mode.

  8. Printer File:

  9. AP1099: The printer file used by AP765N to output 1099 forms, configured with form type 1099, 10 CPI, and 6 LPI.

External Programs Called

  1. #GSORT:
  2. The system sort utility, used to sort the input file ?13? into ?9?AP765S based on 1099 type, vendor, and company.

  3. AP766:

  4. An RPG program (AP766.rpg36.txt) that processes the sorted file ?9?AP765S and the vendor file ?13?, producing the processed file ?9?AP766. It uses the cross-reference file ?9?PA1099X.

  5. AP765N:

  6. An RPG program (not provided, but referenced in the OCL) that reads the processed file ?9?AP766 and prints 1099 forms (likely 1099-NEC) to the printer file AP1099.

  7. AP300 (Referenced):

  8. Mentioned in the programmer note as the period-end process that creates the APVNYYYY file (?13?). Not called directly in this program.

Outputs

  1. Sorted File:
  2. ?9?AP765S: A temporary file containing sorted vendor data, created by #GSORT.

  3. Processed File:

  4. ?9?AP766: A temporary file containing processed data ready for printing, created by AP766.

  5. Printed 1099 Forms:

  6. Output to the printer file AP1099, formatted as 1099 forms (likely 1099-NEC due to ?L'110,1'? being N), with 10 CPI, 6 LPI.

Comparison with AP765.ocl36.txt

  • Similarity: AP765N.ocl36.txt is nearly identical to AP765.ocl36.txt, with the same file handling, sorting logic, and cleanup steps. Both use #GSORT and AP766 for preprocessing and produce output via AP1099.
  • Difference: The key difference is the printing program:
  • AP765.ocl36.txt calls AP765 (likely for 1099-MISC forms, as ?L'110,1'? is M).
  • AP765N.ocl36.txt calls AP765N (likely for 1099-NEC forms, as ?L'110,1'? is N).
  • This suggests AP765N may have specific formatting or logic tailored for 1099-NEC, such as different box assignments or layout.

Summary

  • Purpose: The OCL program AP765N.ocl36.txt processes vendor 1099 forms (likely 1099-NEC) by sorting vendor data, preprocessing it, and printing the forms for a specified year.
  • Process:
  • Deletes existing temporary file ?9?AP766.
  • Sorts the vendor file ?13? (e.g., APVN2012) into ?9?AP765S using #GSORT.
  • Processes sorted data with AP766, producing ?9?AP766.
  • Prints 1099 forms (likely 1099-NEC) using AP765N and printer file AP1099.
  • Cleans up by deleting ?9?AP766.
  • Business Rules:
  • Validates input file and focuses on 1099 type N (Non-Employee Compensation).
  • Sorts data by 1099 type, vendor, and company.
  • Manages temporary files and ensures printer formatting compliance.
  • Maintains Year 2000 compliance.
  • Files Used:
  • Input: ?13? (APVNYYYY), ?9?PA1099X.
  • Temporary: ?9?AP765S, ?9?AP766.
  • Output: AP1099 (printer file).
  • External Programs: #GSORT, AP766, AP765N.

This program provides an alternative path for 1099-NEC form processing, differing from AP765.ocl36.txt primarily in the printing step, ensuring flexibility for different 1099 form types. Since AP765N.rpg36.txt was not provided, I can infer its role based on the context, but a detailed analysis of its logic would require the source code. If you have AP765N.rpg36.txt, please provide it for a complete breakdown.