AR991P OCL
Process Steps of the RPG .OCL Program¶
This .OCL file (Operations Control Language) appears to be a procedure script used in IBM midrange systems (e.g., AS/400 or iSeries) to control the execution of an RPG (Report Program Generator) program. OCL is not the RPG code itself but a job control language that sets up the environment, loads, and runs the RPG program. The script handles parameter passing, variable initialization, file overrides, program execution, conditional checks, and cleanup. Below is a step-by-step breakdown of the process based on the provided OCL code:
-
Procedure Invocation and Parameter Setup (
// SCPROCP ,,,,,,,,?9?
):
This initiates the OCL procedure (likely named SCPROCP or a similar system procedure). The commas represent placeholder parameters (up to 9), with the ninth parameter substituted via?9?
(a variable or passed value, common in OCL for dynamic substitution). This sets up the runtime environment with an external input value for later use (e.g., in file naming). -
Initialize Local Variables (
// LOCAL BLANK-*ALL
):
This command blanks (resets to spaces or null) all local variables in the OCL environment, ensuring a clean state before proceeding. This prevents carryover data from previous runs. -
Call Utility or Pre-Processing Program (
// GSY2K
):
This executes a program or command named GSY2K. Based on the name, it may be a Year 2000 (Y2K) compliance utility or global setup routine (common in legacy systems for date handling or system checks). It runs before the main program to prepare the environment. -
Load the Main RPG Program (
// LOAD AR991P
):
This loads the compiled RPG program named AR991P into memory, preparing it for execution. AR991P is the core RPG component handling the "Accounts Receivable Override Code" logic (as indicated by the comments). -
File Override/Definition (
// FILE NAME-GSCONT,LABEL-?9?GSCONT,DISP-SHR
):
This defines or overrides a file reference: NAME-GSCONT
: Specifies the logical file name used within the program (GSCONT).LABEL-?9?GSCONT
: Sets the physical file label to a dynamic name constructed from the ninth parameter (?9?
) concatenated with "GSCONT" (e.g., if ?9? is "PROD", it becomes "PRODGSCONT").-
DISP-SHR
: Sets the file disposition to shared, allowing concurrent access by other jobs.
This step ensures the RPG program accesses the correct database file based on the passed parameter. -
Execute the Loaded Program (
// RUN
):
This runs the loaded AR991P RPG program. The RPG code (not shown in the OCL) would perform the actual business logic, such as processing accounts receivable overrides, using the overridden file GSCONT. -
Conditional Check and Branch (
// IF ?L'129,6'?/CANCEL GOTO END
):
After the program run, this checks a condition: ?L'129,6'?
retrieves a 6-character value starting at position 129 from the job log or a system area (OCL substitution for log inspection).-
If it equals "/CANCEL", the script branches to the label "END".
This acts as an error or cancellation handler, skipping to cleanup if the program was canceled or encountered a specific condition. -
Label for Branch Target (
// TAG END
):
This defines a label "END" as a jump target for the conditional GOTO, marking the end of the main processing logic. -
Final Cleanup (
// LOCAL BLANK-*ALL
):
This blanks all local variables again, ensuring no residual data remains after execution. This is good practice for procedure termination.
Overall, the OCL script acts as a wrapper to dynamically configure and run the AR991P RPG program for accounts receivable processing, with parameter-driven file access and basic error handling. If the condition in step 7 is met, it short-circuits to cleanup; otherwise, it proceeds directly to the end.
External Programs Called¶
- GSY2K: Called early in the script, likely a utility program (e.g., for Y2K date handling or system setup).
- AR991P: The main RPG program loaded and executed; this is the core component performing the accounts receivable override logic.
No other external programs are explicitly called.
Tables Used¶
- GSCONT: A database file (table) overridden with a dynamic physical name (
?9?GSCONT
). It is accessed in shared mode and is likely the primary data source/target for the RPG program's operations (e.g., storing or retrieving accounts receivable data).
No other tables or files are referenced in the OCL script.