Skip to content

AP125 OCL

The provided OCL (Operation Control Language) script, AP125.ocl36.txt, is part of an IBM AS/400 (iSeries) system and appears to be related to Accounts Payable (A/P) voucher transaction processing. It is called from another OCL script that sets up voucher entry tables. Below, I will explain the process steps of this OCL program, identify the external programs called, and list the tables (files) used.


Process Steps of the OCL Program

The OCL script performs a series of steps to prepare and process Accounts Payable voucher transactions. Here's a breakdown of the steps based on the script:

  1. Invoice Type Selection:
  2. The script starts with a comment indicating AP ARGLMS OR PAPER and a parameter ?8? for selecting the invoice type (N or P). This suggests the script supports different processing modes for invoices (possibly non-PO or PO-based).

  3. File Creation/Verification:

  4. The script checks for the existence of specific files using IFF (If) conditions:
    • DATAF1-?9??20?: Verifies if the file ?9??20? exists. If it does, it builds a file (BLDFILE) with specific attributes (500 records, 404 bytes per record, etc.).
    • DATAF1-?9?APTX?WS?: If this file exists, it builds an index (BLDINDEX) for it with specific key fields and attributes.
    • DATAF1-?9?LMS?WS?: If this file exists, it builds another file with similar attributes.
  5. These steps ensure that necessary temporary or work files (?9??20?, ?9?APTX?WS?, ?9?LMS?WS?) are created or validated before proceeding.

  6. Override Database Files (OVRDBF):

  7. The script uses multiple OVRDBF commands to override the default file definitions, specifying the library (*LIBL/?9?) and member (*FIRST) for various files. This ensures the program uses the correct files from the specified library. The files overridden include:
    • APCONT, GSTABL, FRCINH, FRCFBH, FRCINH4, GLMAST, APVEND, APVENY, SA5FIUD, SA5FIUM, SA5MOUD, SA5MOUM, GSCTUM, APDATE, BICONT, APTRAN.
  8. These overrides are critical to ensure the correct data files are accessed during processing.

  9. Call External Program (AP125P):

  10. The script calls an external program named AP125P with parameters:
    • '10': Likely a mode or control parameter.
    • '?8?': The invoice type (N or P).
    • 'MNT': Indicates maintenance mode (possibly for voucher entry or editing).
    • '?9?': A library or file prefix (dynamic substitution variable).
  11. This program (AP125P) likely performs the core logic for voucher transaction processing, such as editing or validating transactions.

  12. Conditional File Deletion and Creation:

  13. The commented-out GSDELETE APCT?WS? suggests a potential step to delete an existing work file (not executed in this script).
  14. A commented-out BLDFILE ?9?APCT?WS? indicates a step to create a temporary file with 500 records and 80 bytes per record (not executed).
  15. A LOCAL OFFSET-221,DATA-'?9??20?' command suggests setting a local variable or data area with the file name ?9??20?.

  16. Conditional Exit:

  17. The IFF DATAF1-?9??20? GOTO END checks if the file ?9??20? exists. If it does not, the script jumps to the END tag, bypassing the subsequent steps.

  18. Voucher Transaction Edit (AP110):

  19. If the file ?9??20? exists, the script proceeds to the LOAD AP110 section, which is responsible for A/P voucher transaction editing.
  20. File Definitions:
    • The script defines multiple files with their labels and attributes (e.g., DISP-SHR for shared access, EXTEND-100 for extending file size). The files include:
    • APTRAN (labeled ?9??20?): Likely the main transaction file.
    • APCONT, APCHKR, APCHKT (labeled ?9?APCT?WS?), APTRNX (labeled ?9?APTX?WS?), GLMAST, APOPNHC, APINVH, GSTABL, APSTAT, APVEND, INFIL1, INTZH1.
  21. Printer Overrides:
    • If the condition ?9?/G is true, the script overrides the printer file APLIST to output to QUSRSYS/APEDIT.
    • If ?9?/G is false, it overrides APLIST to output to QUSRSYS/TESTOUTQ.
  22. Execution:

    • The RUN command executes the AP110 program, which performs the voucher transaction edit, likely validating or processing transactions and generating a report.
  23. End of Script:

  24. The TAG END marks the end of the script, where processing terminates if the earlier GOTO END condition is met.

External Programs Called

The OCL script explicitly calls the following external programs: 1. AP125P: - Called with parameters: '10', '?8?', 'MNT', '?9?'. - Likely responsible for the main processing of voucher transactions (e.g., data entry, validation, or updates). 2. AP110: - Loaded in the voucher transaction edit section. - Handles the editing or validation of A/P voucher transactions and possibly generates a report.


Tables (Files) Used

The script references the following files (tables) for processing:

  1. From OVRDBF Commands:
  2. APCONT: Accounts Payable control file.
  3. GSTABL: General system table.
  4. FRCINH, FRCFBH, FRCINH4: Likely related to financial or reconciliation data.
  5. GLMAST: General Ledger master file.
  6. APVEND: Vendor master file.
  7. APVENY: Additional vendor file (possibly for secondary vendor data).
  8. SA5FIUD, SA5FIUM, SA5MOUD, SA5MOUM: Likely related to specific application modules (e.g., financial or manufacturing).
  9. GSCTUM: General system customer or control file.
  10. APDATE: Accounts Payable date file.
  11. BICONT: Possibly a billing or contract control file.
  12. APTRAN: Accounts Payable transaction file (labeled ?9??20?).

  13. From AP110 Section:

  14. APTRAN (labeled ?9??20?): Main transaction file.
  15. APCONT ( labeled ?9?APCONT): Control file.
  16. APCHKR: Check register file.
  17. APCHKT (labeled ?9?APCT?WS?): Temporary check file.
  18. APTRNX (labeled ?9?APTX?WS?): Transaction index file.
  19. GLMAST (labeled ?9?GLMAST): General Ledger master.
  20. APOPNHC: Open invoice header file.
  21. APINVH: Invoice header file.
  22. GSTABL (labeled ?9?GSTABL): General system table.
  23. APSTAT: Accounts Payable status file.
  24. APVEND (labeled ?9?APVEND): Vendor master.
  25. INFIL1, INTZH1: Additional files, possibly for interface or temporary data.
  26. APLIST: Printer file for output (report).

  27. Temporary/Work Files:

  28. ?9??20?: Main transaction work file.
  29. ?9?APTX?WS?: Transaction index work file.
  30. ?9?LMS?WS?: Additional work file.
  31. ?9?APCT?WS?: Temporary check file.

Summary

The AP125.ocl36.txt OCL script is designed to set up and process Accounts Payable voucher transactions. It performs the following high-level steps: 1. Validates or creates necessary work files. 2. Overrides database files to ensure correct file access. 3. Calls the AP125P program for core voucher processing. 4. If the main transaction file exists, it loads the AP110 program to edit or validate transactions and generate reports. 5. Uses printer overrides to direct output to specific queues.

External Programs: - AP125P - AP110

Tables/Files: - Core files: APCONT, GSTABL, GLMAST, APVEND, APVENY, APDATE, APTRAN, etc. - Temporary/work files: ?9??20?, ?9?APTX?WS?, ?9?LMS?WS?, ?9?APCT?WS?. - Printer file: APLIST.

This script is tightly integrated with the AS/400 environment, relying on dynamic file naming (via ?9? and ?8?) and external RPG programs to handle the business logic. If you need further clarification or details about specific files or programs, please let me know!