ADMIN_TASK_CANCEL stored procedure

The ADMIN_TASK_CANCEL stored procedure attempts to stop the execution of a task that is currently running.

Start of changeFor a task that is running, the stored procedure cancels the DB2® thread or the JES job that the task runs in, and issues a return code of 0 (zero). If the task is not running or if cancellation of the task cannot be initiated, the stored procedure issues a return code of 12.End of change

Not all tasks can be canceled as requested. Only the administrative task scheduler that currently executes the task can cancel a JCL task or a stored procedure task. Call the ADMIN_TASK_CANCEL stored procedure on the DB2 subsystem that is specified in the DB2_SSID column of the task status.

Begin general-use programming interface information.

Environment

ADMIN_TASK_CANCEL runs in a WLM-established stored procedure address space and uses the Resource Recovery Services attachment facility to connect to DB2.

Authorization

To call this stored procedure, you must have MONITOR1 privilege.

Anyone with SYSOPR, SYSCTRL, or SYSADM authority can call this stored procedure on any task. Anyone who has EXECUTE authority on this stored procedure can call it on tasks that they added. If you try to cancel the execution of a task that was added by a different user, an error is returned in the output.

The task is canceled under the authorization context of the user that currently calls the ADMIN_TASK_CANCEL stored procedure, as defined in CURRENT SQLID. To cancel a stored procedure task, you must have authority to call the DB2 command CANCEL THREAD. To cancel a JCL task, you must have UPDATE authority in RACF® on the resource MVS™.CANCEL.JOB.jobname.

Syntax

The following syntax diagram shows the SQL CALL statement for invoking this stored procedure:

Read syntax diagram
>>-CALL--ADMIN_TASK_CANCEL--(--task-name--,--------------------->

>--return-code--,--message--)----------------------------------><

Option descriptions

task-name
Specifies the unique name of the task whose execution you want to cancel. This is an input parameter of type VARCHAR(128).
return-code
Provides the return code from the stored procedure. Possible values are:
0
The call completed successfully.
12
The call did not complete successfully. The message output parameter contains messages describing the error.

This is an output parameter of type INTEGER.

message
Contains messages describing the error encountered by the stored procedure. The first messages in this area, if any, are generated by the stored procedure. Messages that are generated by DB2 might follow the stored procedure messages.

This is an output parameter of type VARCHAR(1331).

Output

This stored procedure has the following output parameters, which are described in Option descriptions:

  • return-code
  • message

End general-use programming interface information.