DB2 Examples:
1. DB2 example of a call from a Stored Procedure:
Add the following to the declaration section of the stored procedure:
DECLARE v_result INTEGER;
DECLARE v_return_code VARCHAR(1);
DECLARE v_return_msg VARCHAR(256);
Then add the call to Ws_Job_Release:
CALL [METABASE].Ws_Job_Release(p_sequence,p_job_name,p_task_name,p_job_id,p_task_id
,'Daily Run',v_return_code,v_return_msg,v_result);
Perhaps add a check of the result:
IF ( v_result <> 1 ) THEN
SET p_status = v_result;
SET p_return_msg = 'Failed to release Daily Run. Return Code was '||v_return_code;
SET p_return_msg = p_return_msg || '. ' || RTRIM(v_return_msg);
END IF;
2. DB2 example of a call from the DB2 Command Line Processor (db2.exe):
Enter the following after connecting (the metadata is in a schema called QAD Data Warehouse Designer):
call Data Warehouse Designer.Ws_Job_Release(0,'Release Job','Release',0,0,'Daily Run',?,?,?)
The following out is typical:
Value of output parameters
--------------------------
Parameter Name : P_RETURN_CODE
Parameter Value : S
Parameter Name : P_RETURN_MSG
Parameter Value : Job Daily Run released.
Parameter Name : P_RESULT
Parameter Value : 1
Return Status = 0
3. DB2 example of a call from QAD SQL Admin (the metadata is in a schema called QAD Data Warehouse Designer):
{call Data Warehouse Designer.Ws_Job_Release(1, 'Release Daily Job','Release',0,0,'Daily Run',?,?,?)};
Ws_Job_Restart
Ws_Job_Restart allows the automated restarting of a failed job. The intended use of this routine is as part of a database startup to restart any job that may have been stopped as the result of a prior database shutdown. It can be called in any event and will restart the specified job if the job has Failed, or will take no action if the job is in a Wait, Hold, Running, Completed, or Failed - Aborted state.