When CICS® is connected to DB2® Version 5 or earlier, CICS applications that access DB2 will enter a CICS wait, with a resource type of "DB2" and a resource name of "LOT_ECB", while they wait for the CICS DB2 task to access DB2 and complete the request. A CICS task in this wait cannot be purged, but forcepurge is supported. However, there is a risk when forcepurging a CICS task in this state, in that it can cause the associated CICS DB2 task to be terminated during a "must complete" activity in DB2, which would cause termination of the DB2 subsystem.
When CICS is connected to DB2 Version 6 or later, CICS applications that access DB2 do not enter a CICS wait state, because the CICS DB2 task-related user exit and the request into DB2 run on an L8 open TCB. In this environment, both purge and forcepurge of the CICS task are supported. However, with both of these there is again a risk of terminating a DB2 request during a "must complete" activity in DB2.
DB2 "must complete" activities are short-lived, but to avoid this risk, a safer way to terminate a CICS DB2 application is to use the DB2 CANCEL THREAD command. If the CICS DB2 task is active in DB2 at the time, then the thread is terminated, and "must complete" activity is either avoided, or completed before termination. If the task is not active in DB2 at the time of the cancel, then the cancel is deferred until DB2 is next accessed using that thread. Once the DB2 CANCEL THREAD command has been issued, you can safely issue a forcepurge of the CICS transaction, if needed (because the task is currently active in CICS rather than in DB2).
To determine which DB2 thread is associated with a CICS task, use the DSNC DISPLAY TRAN command (see DSNC DISPLAY), which shows the CICS task number, transaction id, and the 12-byte DB2 correlation id of the associated DB2 thread used by the CICS DB2 task. This correlation id uniquely identifies a thread. A DSNC --DIS THD(*), issues a DB2 display thread command showing all threads used by this CICS system identified by correlation id, and gives a unique token that can be used with a DB2 CANCEL THREAD command to cancel the thread.