JOB_INFO table function
The JOB_INFO table function returns one row for each job meeting the selection criteria. It returns information similar to what is returned by the Work with User Jobs (WRKUSRJOB), Work with Subsystem Jobs (WRKSBSJOB), and Work with Submitted Jobs (WRKSBMJOB) CL commands and the List Job (QUSLJOB) API.
Authorization: None required.
- job-status-filter
- A character or graphic string expression that specifies the value
to use as the job status filtering criteria. The string must be one
of the following special values:
- *ALL
- Jobs of any status including jobs on job queues, active jobs, and jobs on an output queue.
- *ACTIVE
- Jobs that are active. You can use the QSYS2.ACTIVE_JOB_INFO table function to get additional details for these jobs.
- *JOBQ
- Jobs that are not active because they are waiting on a job queue.
- *OUTQ
- Jobs that have completed execution and have output on an output queue.
If this parameter is not provided, a value of *ALL is used.
- job-type-filter
- A character or graphic string expression that specifies the value
to use as the job type filtering criteria. The string must be one
of the following special values:
- *ALL
- All types of user jobs, including interactive jobs and batch jobs.
- *BATCH
- Only batch user jobs, including prestart jobs, batch immediate jobs, and autostart jobs.
- *INTERACT
- Only interactive user jobs.
If this parameter is not provided, a value of *ALL is used.
- job-subsystem-filter
- A character or graphic string expression that specifies the subsystem value to use as the job
subsystem filtering criteria. The string can be a subsystem name or the following value:
- *ALL
- All jobs in all subsystems, including jobs that are on job queues and on output queues.
If a subsystem name is provided, only active jobs and jobs that are on job queues are found.
If this parameter is not provided, a value of *ALL is used.
- job-user-filter
- The USER special register or a character or graphic string expression that specifies the user profile name to use as the job user filtering criteria.
- job-submitter-filter
- A character or graphic string expression that specifies the type
of submitted jobs to return. The string must be one of the following
values:
- *ALL
- All submitted jobs.
- *JOB
- Jobs that were submitted from the same job that is invoking this function.
- *USER
- Jobs that were submitted from a job having the same user profile as the job invoking this function.
- *WRKSTN
- Jobs that were submitted from the same work station as the job invoking this function.
If this parameter is not provided, a value of *ALL is used.
Restrictions:
- Only one of these filters can have a value other than *ALL: job-subsystem-filter and job-submitter-filter.
- If a value other than *ALL is specified for job-submitter-filter, you must specify *ALL for job-user-filter.
Notes:
- Jobs submitted with *NO specified for the Allow display by WRKSBMJOB (DSPSBMJOB) parameter of the SBMJOB command are not returned by this table function.
- For equivalence with WRKUSRJOB, a query must always include the predicate WHERE JOB_TYPE NOT IN ('SBS','SYS','RDR','WTR')
- For equivalence with WRKSBSJOB SBS(*OUTQ) or WRKSBSJOB SBS(*ALL), a query must always include the predicate WHERE JOB_TYPE NOT IN ('SBS','SYS')
CL Command | CL Parameters | JOB_INFO invocation |
---|---|---|
WRKSBMJOB | SBMFROM(*USER)
|
|
SBMFROM(*WRKSTN)
|
|
|
SBMFROM(*JOB)
|
|
|
WRKSBSJOB | SBS(QBATCH)
USER(*ALL) |
|
SBS(*JOBQ)
USER(*ALL) |
|
|
SBS(*OUTQ)
USER(JOEUSER) |
|
|
SBS(*ALL)
USER(*ALL) |
|
|
WRKUSRJOB | USER(*)
STATUS(*ALL) JOBTYPE(*ALL) |
|
USER(*)
STATUS(*ALL) JOBTYPE(*INTERACT) |
|
|
USER(JOEUSER)
STATUS(*ACTIVE) JOBTYPE(*ALL) |
|
|
USER(*)
STATUS(*OUTQ) JOBTYPE(*ALL) |
|
|
USER(*ALL)
STATUS(*JOBQ) JOBTYPE(*BATCH) |
|
The result of the function is a table containing multiple rows with the format shown in the following table. All the columns are nullable.
Column Name | Data Type | Description |
---|---|---|
JOB_NAME | VARCHAR(28) | The qualified job name. |
JOB_INFORMATION | VARCHAR(12) | Indicates whether information is
available for the job.
When this value is NO, all columns other than JOB_NAME return the null value. |
JOB_STATUS | VARCHAR(6) | The status of the job.
|
JOB_TYPE | VARCHAR(3) | The type of job.
|
JOB_TYPE_ENHANCED | VARCHAR(28) | The combined job type and job subtype
values.
|
JOB_SUBSYSTEM | VARCHAR(10) | The name of the subsystem for the
job. Contains the null value if the job has no subsystem. |
JOB_DATE | VARCHAR(10) | The date that is assigned to the
job, in *ISO format. The job date remains the same for the duration
of the job unless it is changed by the user. Can also contain the
following special value:
Contains the null value if JOB_STATUS is OUTQ. |
JOB_DESCRIPTION_LIBRARY | VARCHAR(10) | The name of the library containing
the job description. Contains the null value if JOB_DESCRIPTION is null. |
JOB_DESCRIPTION | VARCHAR(10) | The name of the job description
used for this job. Contains the null value if the job has no job description. |
JOB_ACCOUNTING_CODE | VARCHAR(15) | An identifier assigned to the job
by the system to collect resource use information for the job when
job accounting is active. Contains the null value if the job has no accounting code. |
SUBMITTER_JOB_NAME | VARCHAR(28) | The qualified job name of the submitter's
job. Contains the null value if the job has no submitter. |
SUBMITTER_MESSAGE_QUEUE_LIBRARY | VARCHAR(10) | The name of the library containing
the message queue. Contains the null value if the job has no submitter. |
SUBMITTER_MESSAGE_QUEUE | VARCHAR(10) | The name of the message queue where
the system sends a completion message when a batch job ends. Contains the null value if the job has no submitter. |
SERVER_TYPE | VARCHAR(30) | The type of server represented
by the job. See Server table for a list of server type values. Contains the null value if the job is not part of a server. |
JOB_ENTERED_SYSTEM_TIME | TIMESTAMP(0) | The timestamp for when the job was placed on the system. |
JOB_SCHEDULED_TIME | TIMESTAMP(0) | The timestamp for when the job
is scheduled to become active. Contains the null value if this is not a scheduled job. |
JOB_ACTIVE_TIME | TIMESTAMP(0) | The time the job began to run on
the system. Contains the null value if the job did not become active. |
JOB_END_TIME | TIMESTAMP(0) | The timestamp for when the job
completed running on the system. Contains the null value if the job has not ended. |
JOB_END_SEVERITY | SMALLINT | The message severity level of escape messages that can cause a batch job to end. The batch job ends when a request in the batch input stream sends an escape message, whose severity is equal to or greater than this value, to the request processing program. |
COMPLETION_STATUS | VARCHAR(8) | The completion status of the job.
Contains the null value if this the job has not completed. |
JOB_END_REASON | VARCHAR(60) | The most recent action that caused
the job to end. Contains one of the following values:
Contains the null value if job is not currently ending. |
JOB_QUEUE_LIBRARY | VARCHAR(10) | The name of the library containing
the job queue. Contains the null value if JOB_STATUS is OUTQ or if job is not on a job queue and the job is not a batch job that was started from a job queue. |
JOB_QUEUE_NAME | VARCHAR(10) | The name of the job queue that
the job is currently on, or that the job was on if it is currently
active. Contains the null value if JOB_STATUS is OUTQ or if job is not on a job queue and the job is not a batch job that was started from a job queue. |
JOB_QUEUE_STATUS | VARCHAR(9) | The status of this job on the job
queue.
Contains the null value if the job is not on a job queue. |
JOB_QUEUE_PRIORITY | SMALLINT | The scheduling priority of the
job compared to other jobs on the same job queue. The highest priority
is 0 and the lowest is 9. Contains the null value if JOB_STATUS is not JOBQ. |
JOB_QUEUE_TIME | TIMESTAMP(0) | The timestamp when the job was
put on the job queue. Contains the null value if this the job is not on a job queue. |
JOB_MESSAGE_QUEUE_MAXIMUM_SIZE | SMALLINT | The maximum size, in megabytes,
that the job message queue can become. The range is 2 to 64. Contains the null value if JOB_QUEUE_NAME is null. |
JOB_MESSAGE_QUEUE_FULL_ACTION | VARCHAR(8) | The action to take when the message
queue is full.
Contains the null value if JOB_QUEUE_NAME is null. |
ALLOW_MULTIPLE_THREADS | VARCHAR(3) | Indicates whether this job allows
multiple user threads. This attribute does not prevent the operating
system from creating system threads in the job.
|
PEAK_TEMPORARY_STORAGE | INTEGER | The maximum amount of auxiliary
storage, in megabytes, that the job has used. Contains the null value if JOB_STATUS is OUTQ or for a job on a job queue if a value has not been set for the job. |
DEFAULT_WAIT | INTEGER | The default maximum time, in seconds, that a thread in the job
waits for a system instruction, such as a LOCK machine interface (MI) instruction, to acquire a
resource. Contains the null value if there is no maximum, if JOB_STATUS is OUTQ, or for a job on a job queue if a value has not been set for the job. |
MAXIMUM_PROCESSING_TIME_
ALLOWED |
INTEGER | The maximum processing unit time,
in milliseconds, that the job can use. If the job consists of multiple
routing steps, this is the maximum processing unit time that the current
routing step can use. If the maximum time is exceeded, the job is
held. Contains the null value if JOB_STATUS is OUTQ or if no maximum amount of processing unit time has been defined. |
MAXIMUM_TEMPORARY_STORAGE_
ALLOWED |
INTEGER | The maximum amount of auxiliary
storage, in megabytes, that the job can use. If the job consists of
multiple routing steps, this is the maximum temporary storage that
the routing step can use. This temporary storage is used for storage
required by the program itself and by implicitly created internal
system objects used to support the routing step. (It does not include
storage for objects in the QTEMP library.) If the maximum temporary
storage is exceeded, the job is held. This does not apply to the use
of permanent storage, which is controlled through the user profile. Contains the null value if JOB_STATUS is OUTQ or if no maximum amount of temporary storage has been defined. |
TIME_SLICE | INTEGER | The maximum amount of processor
time, in milliseconds, given to each thread in this job before other
threads in this job and in other jobs are given the opportunity to
run. The time slice establishes the amount of time needed by a thread
in this job to accomplish a meaningful amount of processing. At the
end of the time slice, the thread might be put in an inactive state
so that other threads can become active in the storage pool. Values
range from 8 through 9999999. Contains the null value if JOB_STATUS is OUTQ or for a job on a job queue if a value has not been set for the job. |
JOB_SWITCHES | CHAR(8) | The current setting of the job
switches used by this job. Contains the null value no job switches are set. |
ROUTING_DATA | VARCHAR(80) | The routing data that is used to
determine the routing entry that identifies the program to start for
the routing step. Contains the null value if there is no routing data for this job. |
CCSID | INTEGER | The coded character set identifier
(CCSID) used for this job. Contains the null value if no CCSID is defined for this job. |
CHARACTER_IDENTIFIER_CONTROL | VARCHAR(9) | The character identifier control
for the job. This attribute controls the type of CCSID conversion
that occurs for display files, printer files, and panel groups. The
*CHRIDCTL special value must be specified on the CHRID command parameter
on the create, change, or override command for display files, printer
files, and panel groups before this attribute will be used.
|
SORT_SEQUENCE_LIBRARY | VARCHAR(10) | The name or the library that contains
the sort sequence table. Contains the null value if no sort sequence table is defined for this job or if SORT_SEQUENCE_NAME is a special value. |
SORT_SEQUENCE_NAME | VARCHAR(10) | The name of the sort sequence table
associated with this job. Contains the null value if no sort sequence table is defined for this job. |
LANGUAGE_ID | CHAR(3) | The language identifier associated with this job. |
COUNTRY_ID | CHAR(2) | The country or region identifier associated with this job. |
DATE_FORMAT | CHAR(4) | The date format used for this job.
|
DATE_SEPARATOR | CHAR(1) | The date separator used for this job. |
TIME_SEPARATOR | CHAR(1) | The time separator used for this job. |
DECIMAL_FORMAT | VARCHAR(6) | The decimal format used for this
job.
|
TIME_ZONE_DESCRIPTION_NAME | VARCHAR(10) | The name of the time zone description that is used to calculate local job time. |
MESSAGE_LOGGING_LEVEL | SMALLINT | The type of information that is
logged.
|
MESSAGE_LOGGING_SEVERITY | SMALLINT | The severity level that is used in conjunction with the logging level to determine which error messages are logged in the job log. The values range from 0 through 99. |
MESSAGE_LOGGING_TEXT | VARCHAR(7) | The level of message text that
is written in the job log when a message is logged according to the
logging level and logging severity.
|
LOG_CL_PROGRAM_COMMANDS | VARCHAR(4) | Specifies whether or not commands
are logged for CL programs that are run.
|
STATUS_MESSAGE | VARCHAR(7) | Specifies whether status messages
are displayed for this job.
|
INQUIRY_MESSAGE_REPLY | VARCHAR(8) | Specifies how the job answers inquiry
messages.
|
BREAK_MESSAGE | VARCHAR(7) | Specifies how this job handles
break messages.
|
JOB_LOG_OUTPUT | VARCHAR(10) | Specifies how the job log will
be produced when the job completes.
|
JOB_LOG_PENDING | VARCHAR(3) | Specifies whether there is a job
log that has not yet been written. The writing of the job log may
become pending based on the value of the job log output job attribute
when the job completes its activity.
|
OUTPUT_QUEUE_PRIORITY | SMALLINT | The output priority for spooled output files that this job produces. The highest priority is 0, and the lowest is 9. |
OUTPUT_QUEUE_LIBRARY | VARCHAR(10) | The name of the library that contains the default output queue. |
OUTPUT_QUEUE_NAME | VARCHAR(10) | The name of the default output queue that is used for spooled output produced by this job and the name of the library that contains the output queue. The default output queue is only for spooled printer files that specify *JOB for the output queue. |
SPOOLED_FILE_ACTION | VARCHAR(7) | Specifies whether spooled files
are accessed through job interfaces after the job has completed is
normal activity.
|
PRINTER_DEVICE_NAME | VARCHAR(10) | The printer device used for printing output from this job. |
PRINT_KEY_FORMAT | VARCHAR(7) | Specifies whether border and header
information is provided when the Print key is pressed.
|
PRINT_TEXT | VARCHAR(30) | The line of text that is printed
at the bottom of each page of printed output for the job. Contains the null value if there is no text defined to print at the bottom of each page. |
DEVICE_NAME | VARCHAR(10) | The name of the device as identified
to the system. For an interactive job it is the device where the job
started. Contains the null value if this is not an interactive job. |
DEVICE_RECOVERY_ACTION | VARCHAR(13) | The action taken for interactive
jobs when an I/O error occurs for the job's requesting program device.
Contains the null value if this is not an interactive job. |
DDM_CONVERSATION | VARCHAR(5) | Specifies whether connections using
distributed data management (DDM) protocols remain active when they
are not being used. The connections include APPC conversations, active
TCP/IP connections or Opti-Connect connections.
|
MODE_NAME | VARCHAR(8) | The mode name of the advanced program-to-program
communications device that started the job. The following special
value may be returned:
Contains the null value if the job is not using advanced program-to-program communications (APPC). |
UNIT_OF_WORK_ID | CHAR(24) | The unit of work ID is used to
track jobs across multiple systems. Contains the null value if the job is not associated with a source or target system using advanced program-to-program communications (APPC). |
INTERNAL_JOB_ID | BINARY(16) | The internal job identifier. |
Examples
- Find all interactive jobs.
SELECT * FROM TABLE(QSYS2.JOB_INFO(JOB_TYPE_FILTER => '*INTERACT')) X;
- Find jobs submitted by SCOTTF that have not been started.
SELECT * FROM TABLE(QSYS2.JOB_INFO(JOB_USER_FILTER => 'SCOTTF', JOB_STATUS_FILTER => '*JOBQ')) X;