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.RTVJOBA() 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. Unlike the iQuery.JOB_ATTR() UDTF, this function is faster, and JOB_ATTR() actually calls RTVJOBA() to create its resultSet.
iQuery.rtvjoba( fully-qualified JOB name or * for current job, internal job ID binary(16) )
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.
The optional Internal-Job ID parameter may be used instead of the qualified job name parameter. If specified the qualified job name parameter is ignored. This parameter accepts the unique 16-byte binary JOB ID to more quickly find the Job Attributes. Use this when you're doing something like a lateral join to the RTVJOBA UDTF using another view or something like the IBM QSYS2.ACTIVE_JOB_INFO UDTF.
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_Nbr | varchar(6) | The 6-digit job number (as text) |
JOB_DATE | date | The date under which the job is running "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. |
JOB_INTID | binary(16) | The internal job Identifier |
JOBQ_NAME | varchar(10) | Job Queue from which the job was launched. |
JOBQ_LIB | varchar(10) | Job Queue Library from which the job was launched. |
JOBQ_STATUS | varchar(10) | The Job Status on the Job Queue. |
JOBQ_PTY | varchar(2) | The Job Priority on the Job Queue. |
OUTQ_NAME | varchar(10) | The Output Queue Name assigned to SPOOLED output from this job. |
OUTQ_LIB | varchar(10) | The Output Queue Library name. |
OUTQ_PTY | varchar(2) | The Priority of SPOOLED output from this job. |
PRTDEV | varchar(10) | The Printer Device Name associated with this job. |
JobD_Name | varchar(10) | The job description used for the job |
JobD_Lib | varchar(10) | The job description library used by the job. |
JOBLOG_OUTPUT | varchar(10) | The LOGOUTPUT option used when the joblog is created. The value can be *SYSVAL, *JOBLOGSVR, *JOBEND, *PND. |
JOBLOG_PENDING | char(1) | The Joblog Pending attribute. |
Mode_Name | varchar(8) | The Job Mode. |
INQMSGRPY | varchar(10) | Inquiry Message Repy status |
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 |
DayOfWeek | varchar(4) | The day of the week for the job. *MON, *TUE, etc. |
LANGUAGE_ID | varchar(3) | The 3-character language attribute under which the job is running. |
COUNTRY_ID | varchar(2) | The 2-character country code. |
CHAR_ID_CTRL | varchar(10) | Character identifier control. |
CCSID | integer | The job CCSID |
DFTCCSID | integer | If the job CCSID = 65535 then this contains the fallback or default job CCSID to use. |
JOB_GRPPRF | varchar(10) | Group Profile under which job is running. |
JOB_CURUSRPRF | varchar(10) | Current User Profile under which job is running. |
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) | Submitter's Job Number (the Job Number of the job that submitted "this" job) |
SBMJOB_MSGQ | varchar(10) | Submitter's message queue name. |
SBMJOB_MSGQ_LIB | varchar(10) | Submitter's message queue library. |
JOB_SUBSYSTEM | varchar(10) | Subsystem name in which job is running. |
JOB_SUBSYSTEM_LIBRARY | varchar(10) | Subsystem library in which job is running. |
END_SEV | integer | Job end severity level (0 to 99) |
LOG_LEVEL | integer | Log level (1, 2, 3, 4) |
LOG_SEV | integer | Log level severity (0 to 99) |
LOG_MSGTEXTLVL | varchar(10) | Log level Message Text option. *MSG, *SECLVL, or *NOLIST. |
JOB_SWITCHES | varchar(8) | The current UPSI Job Switch values |
MULTITHREAD | char(1) | Indicates if the job support multithreaded processing. The value can be 0 or 1 |
END_STATUS | varchar(10) | Status of job end condition. |
EXIT_KEY | char(1) | Exit key used to end job (F3). |
CANCEL_KEY | char(1) | Cancel key used to end job (F12). |
DEVNAME | varchar(10) | Job device named |
CLIENT_IP | varchar(15) | IP v4 of client device |
RTGDATA | 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.RTVJOBA() ) thisJob';
The Following is a table that identifies the Job Type and SubType columns returned by this UDTF.
WRKACTJOB and QUSRJOBI API Comparison | ||
---|---|---|
If the Job Type Is | 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 |