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);
DECLARE v_job_status_simple VARCHAR(1);
DECLARE v_job_status_standard VARCHAR(1);
DECLARE v_job_status_enhanced VARCHAR(2);
Then add the call to the procedure:
CALL [METABASE].Ws_Job_Status(p_sequence, p_job_name, p_task_name, p_job_id, p_task_id
, NULL, 'Daily Run', 10, NULL
, v_return_code, v_return_msg, v_result
, v_job_status_simple, v_job_status_standard, v_job_status_enhanced);
Perhaps add a check of the result:
IF ( v_result <> 1 ) THEN
SET p_status = v_result;
SET p_return_msg = 'Failed to check job status. 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_Status(1,'Check Job','Stat',0,0,NULL,'Daily Run',10,NULL,?,?,?,?,?,?)
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 Sequence 63 Completed
Parameter Name : P_RESULT
Parameter Value : 1
Parameter Name : P_JOB_STATUS_SIMPLE
Parameter Value : C
Parameter Name : P_JOB_STATUS_STANDARD
Parameter Value : C
Parameter Name : P_JOB_STATUS_ENHANCED
Parameter Value : 9
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_Status(1,'Check Job','Stat',0,0,NULL,'Daily Run',10,NULL,?,?,?,?,?,?)}
Ws_Load_Change
This procedure allows the caller to change either the connection or the schema of a load table.