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() UDF returns a component of the job name identification. Use it to return the job name, number, user profile or internal Job ID.
iQuery.job( job-component-to-retrieve varchar(10) );
The job-component-to-retrieve may be any of the following. Only that component's value is retuned.
Parameter |
Value |
Description |
JOBNAME | Job Name | The name of the job. For interactive jobs this is normally the Workstation ID generated by ACS or similar. For batch jobs it is the name specified on the SBMJOB command. You may also specify NAME to retrieve this component. |
JOBUSER | User Profile | The user profile under which the job is running. You may also specify JOBUSR, USER, USR, or USRPRF to retrieve this component. |
JOBNBR | Job Number | The 6-digit job number (as text). You may also specify NBR to retrieve this component. |
INTJOBID | Internal Job ID | The internal job ID that can be use to more quickly access the job information via IBM i APIs. You may also specify INTID and ID to retrieve this component. |
JOB | Fully qualified job name | The (up to) 28 character fully qualified job name in the 666666/USER/NAME format. You may also specify QUALJOB and QUAL to retrieve this component. |
UDF | Return Type | Description |
JOB | varchar(32) | The job component is always returned as a 32-byte varchar value. See Table 2 below for details on each component. |
The Parameter options my be specified with or without a leading asterisk. Therefore JOB('*JOBNAME') and JOB('JOBNAME') return the same result. Upper/lower case is ignored.
values iQuery.job('job') into :qualJob;
values iQuery.job('*intjobid') into :intJob;