Autonomous
procedures use a unit of work that is independent of the calling application.
However, you can cancel the autonomous procedure by canceling the
invoking thread.
Procedure
To control autonomous procedures:
- Issue a DISPLAY THREAD command to find the status of the
autonomous procedure and the token for the invoking thread.
The
token for the thread is shown in a DSNV520I message.
The following example output from a DISPLAY THREAD command
shows that an autonomous procedure was invoked by the thread with
the token 13:
19.26.27 >dis thd(*) service(stg)
19.26.27 STC00065 DSNV401I > DISPLAY THREAD REPORT FOLLOWS -
19.26.27 STC00065 DSNV402I > ACTIVE THREADS -
NAME ST A REQ ID AUTHID PLAN ASID TOKEN
BATCH RA * 1 TMH11003 SYSADM PLAN2 003D 13
V492-LONG 12K 64VLONG 196K 64LONG 200K ;
V442-CRTKN=USIBMSY.SYEC1DB2.C760EC93ED89 ;
V445-USIBMSY.SYEC1DB2.C760EC93ED89=13 ACCESSING DATA FOR
<SYEC1DB2>-SYEC1DB2 ;
BATCH AT * 0 TMH11003 SYSADM PLAN2 003D 0
V520-AUTONOMOUS PROCEDURE INVOKED BY THREAD WITH TOKEN = 13
V492-LONG 12K 64VLONG 136K 64LONG 260K ;
DISPLAY ACTIVE REPORT COMPLETE
- Issue a CANCEL THREAD command to cancel the thread that
invoked the autonomous procedure.
For example, you might
issue the following command to cancel the thread that invoked the
autonomous procedure shown in the preceding example:
-CANCEL THREAD (13)
Results
COMMIT and ROLLBACK operations that are applied within an
autonomous procedure apply to all procedures and functions that are
nested under the autonomous procedure.