Listing the last execution status of scheduled tasks
You can use the ADMIN_TASK_STATUS() table function to view the last execution status of scheduled tasks.
About this task
Before a task is first scheduled, all columns of its execution status contain null values, as returned by the ADMIN_TASK_STATUS() table function. Afterwards, at least the TASK_NAME, USERID, DB2_SSID, STATUS, NUM_INVOCATIONS and START_TIMESTAMP columns contain non-null values. This information indicates when and under which user ID the task status last changed and the number of times this task was executed. You can interpret the rest of the execution status according to the different values of the STATUS column.
The ADMIN_TASK_STATUS() table function contacts the administrative task scheduler to update the Db2 task list in the SYSIBM.ADMIN_TASKS table, if necessary, and reads the tasks from this task list directly.
Procedure
To determine the last execution status of a scheduled task:
Results
The table that is created by the ADMIN_TASK_STATUS() table function indicates the last execution of scheduled tasks. Each row is indexed by the task name and contains the last execution status of the corresponding task.
If task execution has never been attempted, because the execution criteria have not been met, the STATUS column contains a null value.
If the administrative task scheduler was not able to start executing the task, the STATUS column contains NOTRUN. The START_TIMESTAMP and END_TIMESTAMP columns are the same, and the MSG column indicates why the task execution could not be started. All JCL job execution status columns are NULL, but the Db2 execution status columns contain values if the reason for the failure is related to Db2. (For example, a Db2 connection could not be established.)
If the administrative task scheduler started executing the task but the task has not yet completed, the STATUS column contains RUNNING. All other execution status columns contain null values.
If the task execution has completed, the STATUS column contains COMPLETED. The START_TIMESTAMP and END_TIMESTAMP columns contain the actual start and end times. The MSG column might contain informational or error messages. The Db2 and JCL columns are filled with values when they apply.
If the administrative task scheduler was stopped during the execution of a task, the status remains RUNNING until the administrative task scheduler is restarted. When the administrative task scheduler starts again, the status is changed to UNKNOWN, because the administrative task scheduler cannot determine if the task was completed.