TERMINATE THREAD function for RRSAF

The RRSAF TERMINATE THREAD function deallocates Db2 resources that are associated with a plan and were previously allocated for an application by the CREATE THREAD function. You can then use the CREATE THREAD function to allocate another plan with the same connection.

If you call the TERMINATE THREAD function and the application is not at a point of consistency, RRSAF returns reason code X'00C12211'.

The following diagram shows the syntax of the TERMINATE THREAD function.

DSNRLI TERMINATE THREAD function

Read syntax diagramSkip visual syntax diagramCALL DSNRLI(function, ,retcode,reascode )
Parameters point to the following areas:
function
An 18-byte area the contains TERMINATE THREAD followed by two blanks.
retcode
A 4-byte area in which RRSAF places the return code.

This parameter is optional. If you do not specify retcode, RRSAF places the return code in register 15 and the reason code in register 0.

reascode
A 4-byte area in which RRSAF places the reason code.

This parameter is optional. If you do not specify reascode, RRSAF places the reason code in register 0.

If you specify reascode, you must also specify retcode.

Example of RRSAF TERMINATE THREAD calls

The following table shows a TERMINATE THREAD call in each language.

Table 1. Examples of RRSAF TERMINATE THREAD calls
Language Call example
Assembler
CALL  DSNRLI,(TRMTHDFN,RETCODE,REASCODE)
C1
fnret=dsnrli(&trmthdfn[0], &retcode, &reascode);
COBOL
CALL  'DSNRLI' USING TRMTHDFN RETCODE REASCODE.
Fortran
CALL  DSNRLI(TRMTHDFN,RETCODE,REASCODE)
PL/I1
CALL  DSNRLI(TRMTHDFN,RETCODE,REASCODE);
Note:
  1. For C, C++, and PL/I applications, you must include the appropriate compiler directives, because DSNRLI is an assembler language program. These compiler directives are described in the instructions for invoking RRSAF.