Using the SQR API (PRCSAPI)

This section contains the information that you need to incorporate the SQR API into your PeopleSoft Process Scheduler development.

All variables that are defined in PRCSDEF.SQC should be set (or left as the default) by the application SQR program before you call Update-Process-Status (PRCSAPI.SQC).

Set #prcs_continuejob to 1 if this process is part of a job definition and you want the next process request to run despite the run status that is set by the current request. Normally, subsequent job requests are selected to run only if the prior request finishes with a status of Successful.

Note: All Workflow processes have internal APIs that do not require specific hooks from application modules. For SQR-based members, see XRFWIN.SQR.

Each API-aware SQR must include member PRCSDEF.SQC, and all PSPRCSRQST column-based variables must be properly set by application SQR code. Failure to manage these variables properly in the API can result in SQL update errors based on invalid data for the definition type.

Application programs that are written in SQR can update selected process request fields at runtime using a PeopleSoft-provided API. This is to be used for SQR reports.

Include Files

Include File

Description

PRCSDEF.SQC

Contains the procedure Define-Prcs-Vars. Initializes the fields that are used in the API.

PRCSAPI.SQC

Contains the procedure Get-Run-Control-Parms:

  • Retrieves the three parameters that are described in the following table.

  • Updates the run status of the process request to Processing.

    Contains the procedure Prsc-Run-Status. Performs the process request table update.

SQRs should be defined to accept the following parameters from the command line.

Parameter

Description

Process Instance

Required so that the SQR knows which process request to update.

User ID

Indicates the user ID key to the Run Control table.

Run Control ID

Indicates run control ID key to the Run Control table.

All SQRs use the procedure Get-Run-Control-Parms, which is defined in PRCSAPI.SQC. For example:

Begin-Procedure Get-Run-Control-Parms
    input $prcs_process_instance 
					 ‘Please press ENTER (Do not input a value)’
    if not isnull($prcs_process_instance)
        let #prcs_process_instance = to_number
				($prcs_process_instance)
        input $prcs_oprid 
							‘Please press ENTER (Do not input a value)’
        let $prcs_oprid = upper($prcs_oprid)
        input $prcs_run_cntl_id 
							‘Please press ENTER (Do not input a value)’
    else
        let #prcs_process_instance = 0
    end-if
    if #prcs_process_instance > 0
        let #prcs_run_status = #prcs_run_status_processing
        do Update-Prcs-Run-Status
        let #prcs_run_status = #prcs_run_status_successful
    end-if
end-procedure

The three input commands correspond to the three values in the command line:

%%INSTANCE%% %%OPRID%% %%RUNCNTLID%%

When you run the SQR through SQR Windows (SQRW) and don’t enter any input values, the SQR interprets this as having been run outside PeopleSoft Process Scheduler. Therefore, it prompts for other input parameters that otherwise come from Run Control tables.

An API-aware SQR program in PeopleSoft Process Scheduler must update the run status of the request to:

  • Processing upon receiving control.

  • Success or No Success upon completion.

Note: All other SQR runtime parameters should reside in a run control record that is keyed by user ID and run control ID.