ADMIN_TASK_STATUS table function
The ADMIN_TASK_STATUS function returns a table with one row for each task that is defined in the administrative task scheduler task list. Each row indicates the status of the task for the last time it was run.
Optionally, if you specify the max-history parameter, the function returns a row of data for each execution of a task (up to the max-history value). For tasks that have not been executed, this function returns a row of data with a NULL status.
Authorization
The user who calls this function must have MONITOR1 privilege.
The schema is DSNADM.
- max-history
- Specifies the maximum number of execution statuses per task to
be returned. The most recent execution statuses are returned.
If the parameter is set to NULL, all available task execution statuses are returned. If the parameter is set to 1, only the status for the last time the task was run is returned, which is the same result as not specifying this option. This is an input parameter of type INTEGER.
Column name | Data type | Contains |
---|---|---|
TASK_NAME | VARCHAR(128) | Contains the name of the task that has run, is running, or has been bypassed. |
STATUS | VARCHAR(10) | Contains one of the following
values that indicates task status:
|
NUM_
INVOCATIONS |
INTEGER | Contains the number of times the administrative task scheduler attempted to run the task, including the current time if the task is currently running. The values in this column does not indicate if the task was successfully run. |
START_
TIMESTAMP |
TIMESTAMP | Contains the time when the task started running if the STATUS column contains COMPLETED, RUNNING, or UNKNOWN. Otherwise, this column contains the time that the task should have started to run but could not. |
END_
TIMESTAMP |
TIMESTAMP | Contains the time when the task finished running. |
JOB_ID | CHAR(8) | Contains the job ID that is assigned to the JCL job submitted by the administrative task scheduler. This column contains NULL if the task is a stored procedure or if the STATUS column does not contain COMPLETED. |
MAXRC | INTEGER | Contains the highest return code from submitting
a JCL job. If the task is synchronous, the value in this column is
changed to the return code that is returned when the job finishes
running. This column is set to NULL if the task is a stored procedure, if the STATUS column does not contain COMPLETED, or if a synchronous task is finished and has run with JES3 in a z/OS® 1.7 or earlier system. |
COMPLETION_
TYPE |
INTEGER | Contains one of the following values that indicates
the completion type of the JCL job submitted by the administrative
task scheduler:
This column contains NULL if the task is a stored procedure, if the STATUS column does not contain COMPLETED, or if the JCL job is run with JES3 in a z/OS 1.7 or earlier system. |
SYSTEM_
ABENDCD |
INTEGER | Contains the system abend code returned by a failed
JCL job that was submitted by the administrative task scheduler. This column contains NULL if the task is a stored procedure, if the STATUS column does not contain COMPLETED, or if the JCL job is run with JES3 in a z/OS 1.7 or earlier system. |
USER_ABENDCD | INTEGER | Contains the user abend code returned by a failed
JCL job that was submitted by the administrative task scheduler. This column contains NULL if the task is a stored procedure, if the STATUS column does not contain COMPLETED, or if the JCL job is run with JES3 in a z/OS 1.7 or earlier system. |
MSG | VARCHAR(128) | Contains the error or warning message from the last time the task was run. |
SQLCODE | INTEGER | Contains the SQLCODE set by Db2 when a stored procedure was called by the administrative task scheduler. This column contains NULL if the task is a JCL job or if the STATUS column does not contain COMPLETED. |
SQLSTATE | CHAR(5) | Contains the SQLSTATE set by Db2 when a stored procedure was called by the administrative task scheduler. This column contains NULL if the task is a JCL job or if the STATUS column does not contain COMPLETED. |
SQLERRP | VARCHAR(8) | Contains the SQLERRP set by Db2 when a stored procedure was called by the administrative task scheduler. This column contains NULL if the task is a JCL job or if the STATUS column does not contain COMPLETED. |
SQLERRMC | VARCHAR(70) | Contains the SQLERRMC set by Db2 when a stored procedure was called by the administrative task scheduler. This column contains NULL if the task is a JCL job or if the STATUS column does not contain COMPLETED. |
DB2_SSID | VARCHAR(4) | Contains the Db2 subsystem ID that is associated with the administrative task scheduler that ran the task or should have run the task. |
USERID | VARCHAR(128) | Contain the user ID that the task ran under. |
SELECT *
FROM TABLE (DSNADM.ADMIN_TASK_STATUS()) AS T;