Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
The iQuery.Job_Attr() UDTF returns a one row result that contains the attributes for the specified Job or the current job, if no job id is specified. The information returned is similar to that which is returned by the QUSRJOBI API for formats JOBI0300 and JOBI0400.
UDF | Return Type | Description |
JOB_ATTR | TABLE | Returns a one-row resultSet that contains most job attribute properties. |
table( iQuery.job_attr( fully-qualified JOB name or * for current job ))
The Fully-Qualified Job Name parameter may contain a 3-part qualified job name (job number/user/jobname) whose attributes are to be returned.
The optional * may be specified to indicate the curent job's attributes are to be returned. This is the default if no value is specified.
Column | Type | Description |
JOB | varchar(28) | The fully qualified job name whose attributes are returned. |
Job_Status | varchar(10) | The job status (active, held, wait, etc.) |
Job_Type | varchar(1) | Interactive, Batch, Autostart etc. Job indicator. See table below for details. |
Job_SubType | varchar(1) | The subtype for the job See table below for more information. |
Job_Name | varchar(10) | The 10-character job name. |
Job_User | varchar(10) | The User Profile of the job. |
Job_Number | varchar(6) | The 6-digit job number (as text) |
Job_Date | date | The date for the job "Job Date" |
Date_Entered_System | timeStamp | The date/time when the job entered the system. |
Date_Job_Active | timeStamp | The date/time when the job because active. |
JobD_Name | varchar(10) | The job description used for the job |
JobD_Lib | varchar(10) | The job description library used by the job. |
Mode_Name | varchar(8) | The Job Mode. |
LOGCLPGM | varchar(10) | The Log CL Program attribute (*YES or *NO) |
BRKMSGHDL | varchar(10) | The break message handling attribute. The values can be *NORMAL, *NOTIFY, *HOLD |
STSMSGHDL | varchar(10) | The status message handling attribute. The value can be *USRPRF, *SYSVAL, *NONE, *NORMAL |
DECFMT | char(1) | Job numeric (decimal point) format. Returned values include: Blank, J, or I |
DATESEP | char(1) | Job Date separator character. |
DATEFMT | char(4) | Job Date format. |
TIMESEP | char(1) | Time separator character. |
TIME_ZONE | varchar(10) | Time Zone property |
LANGUAGE_ID | varchar(3) | The 3-character language attribute under which the job is running. |
COUNTRY_ID | varchar(2) | The 2-character country code. |
CCSID | int | The job CCSID |
DFTCCSID | int | If the job CCSID = 65535 then this contains the fallback or default job CCSID to use. |
SBMJOB_NAME | varchar(10) | The Name component of the job that submitted "this" job. |
SBMJOB_USER | varchar(10) | The User Profile component of the job that submitted "this" job. |
SBMJOB_NBR | varchar(6) | The Job Number of the job that submitted "this" job. |
JOB_SWITCHES | varchar(8) | The current UPSI Job Switch values |
JOBLOG_OUTPUT | varchar(10) | The job log output option. The values can be *SYSVAL, *JOBLOGSVR, *JOBEND, *PND. |
ALLOW_MULTIPLE_THREADS | char(1) | Indicates if the job support multithreaded processing. The value can be 0 or 1 |
ROUTING_DATA | varchar(80) | The Routing Data for the job. |
The following example returns the job attributes for the current job (the one running the SQL statement).
select * from table( iQuery.job_attr()) myJob';
The Following is a table that identifies the Job Type and SubType columns returned by this UDTF.
WRKACTJOB and QUSRJOBI API Comparison | ||
---|---|---|
Job Type Field | Job Type | Job Subtype |
ASJ (Autostart) | A | blank |
BCH (Batch) | B | blank |
BCI (Batch immediate) | B | D |
EVK (Started by a program start request) | B | E |
INT (Interactive) | I | blank |
M36 (System i™ Advanced 36® machine server) | B | F |
MRT (Multiple requester terminal) | B | T |
PJ (Prestart job) | B | J |
PDJ (Print driver job) | W | P |
RDR (Reader) | R | blank |
SYS (System) | S or X | blank |
SBS (Subsystem monitor) | M | blank |
WTR (Writer) | W | blank |
blank (Alternative user subtype--not an active job) | B | U |
There is also a JOB_ATTR VIEW that you can query instead of using the JOB_ATTR() UDTF. When the current job attributes are desired, use the iQuery.JOB_ATTR view. It contains all the columns from the UDTF without the need to use the UDTF itself. Making querying the information a little easier.
There are a few column names that have been expande and System Column Names were added to create 10-character column alias names.
Column | System Colun |
Type | Description |
JOB | JOB | varchar(28) | The fully qualified job name whose attributes are returned. |
Job_Status | JOBSTATUS | varchar(10) | The job status (active, held, wait, etc.) |
Job_Type | JOBTYPE | varchar(1) | Interactive, Batch, Autostart etc. Job indicator. See table below for details. |
Job_SubType | JOBSUBTYPE | varchar(1) | The subtype for the job See table below for more information. |
Job_Name | JOBNAME | varchar(10) | The 10-character job name. |
Job_User | JOBUSER | varchar(10) | The User Profile of the job. |
Job_Number | JOBNBR | varchar(6) | The 6-digit job number (as text) |
Job_Date | JOBDATE | date | The date for the job "Job Date" |
Date_Entered_System | ENTDATE | timeStamp | The date/time when the job entered the system. |
Date_Job_Active | STARTDATE | timeStamp | The date/time when the job because active. |
JobD_Name | JOBDNAME | varchar(10) | The job description used for the job |
JobD_Lib | JOBDLIB | varchar(10) | The job description library used by the job. |
Mode_Name | JOBMODE | varchar(8) | The Job Mode. |
LOGCLPGM | LOGCLPGM | varchar(10) | The Log CL Program attribute (*YES or *NO) |
BRKMSGHANDLING | BRKMSGHDL | varchar(10) | The break message handling attribute. The values can be *NORMAL, *NOTIFY, *HOLD |
STSMSGHANDLING | STSMSGHDL | varchar(10) | The status message handling attribute. The value can be *USRPRF, *SYSVAL, *NONE, *NORMAL |
DECFMT | DECFMT | char(1) | Job numeric (decimal point) format. Returned values include: Blank, J, or I |
DATESEP | DATESEP | char(1) | Job Date separator character. |
DATEFMT | DATEFMT | char(4) | Job Date format. |
TIMESEP | TIMESEP | char(1) | Time separator character. |
TIME_ZONE | TIMEZONE | varchar(10) | Time Zone property |
LANGUAGE_ID | LANGID | varchar(3) | The 3-character language attribute under which the job is running. |
COUNTRY_ID | CNTRYID | varchar(2) | The 2-character country code. |
CCSID | CCSID | int | The job CCSID |
DFTCCSID | DFTCCSID | int | If the job CCSID = 65535 then this contains the fallback or default job CCSID to use. |
SBMJOB_NAME | SBMJOB | varchar(10) | The Name component of the job that submitted "this" job. |
SBMJOB_USER | SBMJOBUSER | varchar(10) | The User Profile component of the job that submitted "this" job. |
SBMJOB_NBR | SBMJOBNBR | varchar(6) | The Job Number of the job that submitted "this" job. |
JOB_SWITCHES | SWITCHES | varchar(8) | The current UPSI Job Switch values |
JOBLOG_OUTPUT | JOBLOGOUT | varchar(10) | The job log output option. The values can be *SYSVAL, *JOBLOGSVR, *JOBEND, *PND. |
ALLOW_MULTIPLE_THREADS | MULTITHD | char(1) | Indicates if the job support multithreaded processing. The value can be 0 or 1 |
ROUTING_DATA | RTGDATA | varchar(80) | The Routing Data for the job. |