Canceling threads

You can use the CANCEL THREAD command to terminate threads that are active or suspended in Db2.

Before you begin

Using the CANCEL THREAD command requires SYSOPR authority or higher.

About this task

The command has no effect if the thread is not active or suspended in Db2.

Begin general-use programming interface information. If the thread is processing in VTAM® or TCP/IP, you can use VTAM or TCP/IP commands to terminate the conversations.

You can use the DISPLAY THREAD command to determine if a thread is hung in Db2 or VTAM. In VTAM, there is no reason to use the CANCEL command.

Procedure

To terminate a thread, enter one of the following commands:

  • To cancel a thread with a token, enter:
    -CANCEL THREAD (token)
  • Alternatively, you can use the following version of the command with either the token or LUW ID:
    -CANCEL DDF THREAD (token or luwid)

Results

The token is a 1-character to 5-character number that identifies the thread result. When Db2 schedules the thread for termination, the following message for a distributed thread is issued:

DSNL010I - DDF THREAD token or luwid HAS BEEN CANCELED

For a non-distributed thread, you see the following message:

DSNV426I - csect THREAD token HAS BEEN CANCELED

As a result of entering CANCEL THREAD, the following messages can be displayed:

  • DSNL009I
  • DSNL010I
  • DSNL022I

CANCEL THREAD allows you to specify that a diagnostic dump be taken. End general-use programming interface information.