Terminating an online utility

You can terminate the execution of an active utility or release the resources that are associated with a stopped utility.

About this task

Begin general-use programming interface information.

After you terminate a utility, you cannot restart the terminated utility job. The objects on which the utility was operating might be left in an indeterminate state. In many cases, you cannot rerun the same utility without first recovering the objects on which the utility was operating. The situation varies, depending on the utility and the phase that was in process when you issued the command. These considerations about the state of the object are particularly important when you terminate the COPY, LOAD, and REORG utilities.

Procedure

To terminate an online utility:

Issue the TERM UTILITY command. If the utility was started in a previous release of Db2, issue the TERM UTILITY command from that release.
In a data sharing environment, the following rules apply:
  • For active utilities, issue the command from the Db2 subsystem on which the utility was started. If a Db2 subsystem fails while a utility is in progress, you must restart that Db2 subsystem, and then you can terminate the utility from any system.
  • For stopped utilities, you can terminate them from any active member of the data sharing group.
  • In a data sharing coexistence environment, you can terminate a utility only on the same release in which the utility was started.

If the utility is active, Db2 terminates the execution of the utility at the next commit point and then performs any necessary cleanup operations. If the utility is stopped, Db2 releases the resources that are associated with the stopped utility.

Example of conditionally terminating a utility

You can put the TERM UTILITY command in a conditionally executed job step, as shown in the following example. You might choose to add such a job step if you never want to restart certain utility jobs.

//TERM EXEC PGM=IKJEFT01,COND=((8,GT,S1),EVEN)
//*
//**********************************************************
//* IF THE PREVIOUS UTILITY STEP, S1, ABENDS, ISSUE A
//* TERMINATE COMMAND.  IT CANNOT BE RESTARTED.
//**********************************************************
//*
//SYSPRINT DD  SYSOUT=A
//SYSTSPRT DD  SYSOUT=A
//SYSOUT   DD  SYSOUT=A
//SYSUDUMP DD  SYSOUT=A
//SYSTSIN  DD  *
DSN SYSTEM(DSN)
-TERM UTILITY(TEMP)
END
/*

Alternatively, consider specifying the TIMEOUT TERM parameter for some online REORG situations.End general-use programming interface information.