ADMIN_TASK_REMOVE stored procedure

The SYSPROC.ADMIN_TASK_REMOVE stored procedure removes a task from the task list of the administrative task scheduler.

If the task is running, the task continues to execute until completion and is not removed from the task list. If other tasks depend on the execution of the task that is to be removed, the task is not removed from the task list of the administrative task scheduler.

Begin general-use programming interface information.

Environment

See the recommended environment in installation job DSNTIJRA.

Authorization

Users with SYSOPR, SYSCTRL, or SYSADM authority can remove any task. Other users who have EXECUTE authority on this stored procedure can remove tasks that they added. Attempting to remove a task that was added by a different user returns an error in the output.

The user who calls this stored procedure must have MONITOR1 privilege.

Syntax

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

>>-CALL--SYSPROC.ADMIN_TASK_REMOVE--(--task-name,--------------->

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

Option descriptions

task-name
Specifies the name of the task to be removed from the task list of the administrative task scheduler.

This is an input parameter of type VARCHAR(128) and cannot be null.

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).

Example

The following Java sample shows how to invoke ADMIN_TASK_REMOVE:

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.Timestamp; 
import java.sql.Types;

Connection con =   
  DriverManager.getConnection("jdbc:db2://myserver:myport/mydatabase",
  "myuser", "mypassword"); 
CallableStatement callStmt = 
  con.prepareCall("CALL SYSPROC.ADMIN_TASK_REMOVE(?, ?, ?)"); 
// provide the id of the task to be removed
callStmt.setString(1, "mytask"); 
// register output parameters for error management
callStmt.registerOutParameter(2, Types.INTEGER); 
callStmt.registerOutParameter(3, Types.VARCHAR); 
// execute the statement callStmt.execute(); 
// manage the return code 
if ( callStmt.getInt(2) == 0 ) 
  {
  System.out.print("\nSuccessfully removed task "
                   + callStmt.getString(1)); 
  } 
else 
  { 
  System.out.print("\nError code and message are: "
                   + callStmt.getInt(2) + "/" 
                   + callStmt.getString(3));
  }

Output

The output of this stored procedure includes the following output parameters, which are described in Option descriptions:

  • return-code
  • message

End general-use programming interface information.