List Job (QUSLJOB) API
Required Parameter Group:
1 | Qualified user space name | Input | Char(20) |
2 | Format name | Input | Char(8) |
3 | Qualified job name | Input | Char(26) |
4 | Status | Input | Char(10) |
Optional Parameter Group 1:
5 | Error Code | I/O | Char(*) |
Optional Parameter Group 2:
6 | Job type | Input | Char(1) |
7 | Number of fields to return | Input | Binary(4) |
8 | Key of fields to return | Input | Array(*) of Binary(4) |
Optional Parameter Group 3:
9 | Continuation handle | Input | Char(48) |
Default Public Authority: *USE
Threadsafe: Conditional; see Usage Notes.
The List Job (QUSLJOB) API generates a list of all or some jobs on the system. The generated list replaces any existing list in the user space.
The QUSLJOB API produces a list similar to the list produced by the Work with User Job (WRKUSRJOB) command.
Authorities and Locks
- User Space Authority
- *CHANGE
- Library Authority
- *EXECUTE
- User Space Lock
- *EXCLRD
- Job Authority
- If format JOBL0200 is specified, then for each job for which information is
retrieved, the caller of the API must be running under a user profile that is
the same as the job user identity of the job for which the information is being
retrieved. Otherwise, the caller of the API must be running under a user
profile that has job control (*JOBCTL) special authority.
The job user identity is the name of the user profile by which a job is known to other jobs. It is described in more detail in the Work management topic collection.
Required Parameter Group
- Qualified user space name
- INPUT; CHAR(20)
The user space that is to receive the generated list, and the library in which it is located. The first 10 characters contain the user space name, and the second 10 characters contain the library name. You can use these special values for the library name:
*CURLIB The job's current library *LIBL The library list
- Format name
- INPUT; CHAR(8)
The format of the job list to be returned. If format JOBL0200 is specified, the fields that were selected by the caller will be returned for each job in the list. This format is slower than the JOBL0100 format. The performance will vary depending on the number of fields selected.
You must use one of the following format names:
JOBL0100 Basic job list. JOBL0200 Basic job list with keyed return fields. For more information, see Format of the Generated List.
- Qualified job name
- INPUT; CHAR(26)
The name of the job to be included in the list. The qualified job name has three parts:
Job name CHAR(10). A specific job name, a generic name, or one of the following special values:
* Only the job that this program is running in. The rest of the qualified job name parameter must be blank. *CURRENT All jobs with the current job's name. *ALL All jobs. The rest of the job name parameter must be specified.
User name CHAR(10). A specific user profile name, a generic name, or one of the following special values:
*CURRENT Jobs with the current job's user profile. *ALL Jobs with the specified job name, regardless of the user name. The rest of the job name parameter must be specified.
Job number CHAR(6). A specific job number or the following special value:
*ALL Jobs with the specified job name and user name, regardless of the job number. The rest of the job name parameter must be specified.
- Status
- INPUT; CHAR(10)
The status of the jobs to be included in the list. The special values supported are:
*ACTIVE Active jobs. This includes group jobs, system request jobs, and disconnected jobs. *JOBQ Jobs currently on job queues. *OUTQ Jobs that have completed running but still have output on an output queue or the job's job log has not yet been written. *ALL All jobs, regardless of status.
Optional Parameter Group 1
- Error code
- I/O; CHAR(*)
The structure in which to return error information. For the format of the structure, see Error code parameter. If this parameter is omitted, diagnostic and escape messages are issued to the application.
Optional Parameter Group 2
- Job type
- INPUT; CHAR(1)
The type of job to be listed. Refer to Comparing Job Type and Subtype with the Work with Active Job Command in the Retrieve Job Information (QUSRJOBI) API for information about how the job type field and the job subtype field equate to the type field in the Work with Active Job (WRKACTJOB) command.
The possible values for this parameter are:
* This value lists all job types. A The job is an autostart job. B The job is a batch job. I The job is an interactive job. M The job is a subsystem monitor job. R The job is a spooled reader job. S The job is a system job. W The job is a spooled writer job. X The job is the start-control-program-function (SCPF) system job.
- Number of fields to return
- INPUT; BINARY(4)
The number of fields to return in the JOBL0200 format. This parameter is only used for the JOBL0200 format. If JOBL0100 is specified for the format name, the value must be zero.
- Key of fields to be returned
- INPUT; ARRAY(*) of BINARY(4)
The list of the fields to be returned in the JOBL0200 format. For a list of the valid fields, see Valid Keys. This parameter is used for the JOBL0200 format only. If JOBL0100 is specified for the format name, the value must be zero.
Optional Parameter Group 3
- Continuation handle
- INPUT; CHAR(48)
The value returned to the user in the header section when a partial list is returned. The possible values are:
blank This starts at the beginning of the list. This value is used if this parameter is omitted. value The entries after this value matching the job name specified are returned in the list. For more information on using this value to process a partial list, see Partial list considerations.
Format of the Generated List
The job list consists of:
- A user area
- A generic header
- An input parameter section
- A header section
- A list data section
For details about the user area and generic header, see User spaces. For details about the remaining items, see the following sections. For detailed descriptions of the fields in the list returned, see Field Descriptions.
When you retrieve list entry information from a user space, you should use the entry size returned in the generic header. The size of each entry may be padded at the end. If you do not use the entry size, the result may not be valid. For examples of how to process lists, see Examples: APIs and exit programs.
Input Parameter Section
Offset | Type | Field | |
---|---|---|---|
Dec | Hex | ||
0 | 0 | CHAR(10) | Job name specified |
10 | A | CHAR(10) | User name specified |
20 | 14 | CHAR(6) | Job number specified |
26 | 1A | CHAR(10) | Status |
36 | 24 | CHAR(10) | User space specified |
46 | 2E | CHAR(10) | User space library specified |
56 | 38 | CHAR(8) | Format name specified |
64 | 40 | CHAR(1) | Job type specified |
65 | 41 | CHAR(3) | Reserved |
68 | 44 | BINARY(4) | Number of fields to return specified |
72 | 48 | ARRAY(*) of BINARY(4) | Key of fields to return specified |
* | * | CHAR(48) | Continuation handle |
Header Section
Offset | Type | Field | |
---|---|---|---|
Dec | Hex | ||
0 | 0 | CHAR(10) | Job name used |
10 | A | CHAR(10) | User name used |
20 | 14 | CHAR(6) | Job number used |
26 | 1A | CHAR(48) | Continuation handle |
JOBL0100 Format
Offset | Type | Field | |
---|---|---|---|
Dec | Hex | ||
0 | 0 | CHAR(10) | Job name used |
10 | A | CHAR(10) | User name used |
20 | 14 | CHAR(6) | Job number used |
26 | 1A | CHAR(16) | Internal job identifier |
42 | 2A | CHAR(10) | Status |
52 | 34 | CHAR(1) | Job type |
53 | 35 | CHAR(1) | Job subtype |
54 | 36 | CHAR(2) | Reserved |
JOBL0200 Format
Offset | Type | Field | |
---|---|---|---|
Dec | Hex | ||
0 | 0 | CHAR(56) | Everything in JOBL0100 format |
56 | 38 | CHAR(1) | Job information status |
57 | 39 | CHAR(3) | Reserved |
60 | 3C | BINARY(4) | Number of fields returned |
These fields repeat, in the order listed, for each key selected. | BINARY(4) | Length of field information returned | |
BINARY(4) | Key field | ||
CHAR(1) | Type of data | ||
CHAR(3) | Reserved | ||
BINARY(4) | Length of data | ||
CHAR(*) | Data | ||
CHAR(*) | Reserved |
Field Descriptions
Data. The data returned for the key field.
Format name specified. The format name as specified in the call to the API.
Internal job identifier. A value sent to other APIs to speed the process of locating the job on the system. Only APIs described in this topic use this identifier. The identifier is not valid following an initial program load (IPL). If you attempt to use it after an IPL, an exception occurs.
Job information status. Whether the information was available for the job. The possible values are:
blank | The information was available. |
A | The user was not authorized to the job. |
L | The information was not available because the job was not accessible. |
Job name specified. The name of the job as specified in the call to the API.
Job name used. The name of the job as identified to the system. For an interactive job, the system assigns the job the name of the work station where the job started; for a batch job, you specify the name in the command when you submit the job.
Job number specified. The job number as specified in the call to the API.
Job number used. The system-assigned job number.
Job subtype. Additional information about the job type (if any exists). Refer to Comparing Job Type and Subtype with the Work with Active Job Command in the Retrieve Job Information (QUSRJOBI) API for information about how the job type field and the job subtype field equate to the type field in the Work with Active Job (WRKACTJOB) command. The possible values are:
blank | The job has no special subtype. |
D | The job is a batch immediate job. |
E | The job started with a procedure start request. |
F | The job is a System i™ Advanced 36® machine server job. |
J | The job is a prestart job. |
P | The job is a print driver job. |
T | The job is a System/36™ multiple requester terminal (MRT) job. |
U | The job is an alternate spool user. |
Job type. The type of job. Refer to Comparing Job Type and Subtype with the Work with Active Job Command in the Retrieve Job Information (QUSRJOBI) API for information about how the job type field and the job subtype field equate to the type field in the Work with Active Job (WRKACTJOB) command. The possible values for this field are:
A | The job is an autostart job. |
B | The job is a batch job. |
I | The job is an interactive job. |
M | The job is a subsystem monitor job. |
R | The job is a spooled reader job. |
S | The job is a system job. |
W | The job is a spooled writer job. |
X | The job is the SCPF system job. |
Job type specified. The job type as specified in the call to the API.
Key field. The field returned. See Valid Keys for the list of valid keys.
Key of fields to return specified. The key of fields to return as specified in the call to the API.
Length of data. The length of the data returned for the field.
Length of field information returned. The total length of information returned for this field. This value is used to increment to the next field in the list.
Number of fields returned. The number of fields returned to the application.
Number of fields to return specified. The number of fields to return as specified in the call to the API.
Reserved. An ignored field.
Status. The status of the job. The valid values are:
*ACTIVE | The job has started, and it can use system
resources (processing unit, main storage, and so on). This does not guarantee
that the job is currently running, however. For example, an active job may be
in one of the following states where it is not in a position to use system
resources:
|
*JOBQ | The job is currently on a job queue. The job
possibly was previously active and was placed back on the job queue because of
the Transfer Job (TFRJOB) or Transfer Batch Job (TFRBCHJOB) command, or the job
was never active because it was just submitted. |
*OUTQ | The job has completed running and has spooled output that has not yet printed or the job's job log has not yet been written. |
Type of data. The type of data returned.
C | The data is returned in character format. |
B | The data is returned in binary format. |
User name specified. The user name as specified in the call to the API.
User name used. The user profile under which the job is run. The user name is the same as the user profile name and can come from several different sources depending on the type of job.
User space library specified. The name of the library containing the user space as specified in the call to the API.
User space specified. The name of the user space as specified in the call to the API.
Valid Keys
The following table contains a list of the valid keys. The descriptions of all the valid key attributes are described in Work Management API Attribute Descriptions (WMAttrDesc).
Key | Type | Description |
---|---|---|
101 | CHAR(4) | Active job status |
102 | CHAR(1) | Allow multiple threads |
103 | CHAR(4) | Active job status for jobs ending |
201 | CHAR(10) | Break message handling |
301 | CHAR(1) | Cancel key |
302 | BINARY(4) | Coded character set ID |
303 | CHAR(2) | Country or region ID |
304 | BINARY(4) | Processing unit time used, if less than 2,147,483,647 milliseconds |
305 | CHAR(10) | Current user profile |
306 | CHAR(1) | Completion status |
307 | BINARY(4) | Current system pool identifier |
311 | CHAR(10) | Character identifier control |
312 | BINARY(8), UNSIGNED | Processing unit time used - total for the job |
313 | BINARY(8), UNSIGNED | Processing unit time used for database - total for the job |
401 | CHAR(13) | Date and time job became active |
402 | CHAR(13) | Date and time job entered system |
403 | CHAR(8) | Date and time job is scheduled to run |
404 | CHAR(8) | Date and time job was put on this job queue |
405 | CHAR(4) | Date format |
406 | CHAR(1) | Date separator |
407 | CHAR(1) | DBCS-capable |
408 | CHAR(10) | DDM conversation handling |
409 | BINARY(4) | Default wait |
410 | CHAR(13) | Device recovery action |
411 | CHAR(10) | Device name |
412 | BINARY(4) | Default coded character set identifier |
413 | CHAR(1) | Decimal format |
418 | CHAR(13) | Date and time job ended |
501 | BINARY(4) | End severity |
502 | CHAR(1) | End status |
503 | CHAR(1) | Exit key |
601 | CHAR(10) | Function name |
602 | CHAR(1) | Function type |
701 | CHAR(1) | Signed-on job |
702 | CHAR(10) | Group profile name |
703 | CHAR(150) | Group profile name - supplemental |
901 | CHAR(10) | Inquiry message reply |
1001 | CHAR(15) | Job accounting code |
1002 | CHAR(7) | Job date |
1003 | CHAR(20) | Job description name - qualified |
1004 | CHAR(20) | Job queue name - qualified |
1005 | CHAR(2) | Job queue priority |
1006 | CHAR(8) | Job switches |
1007 | CHAR(10) | Job message queue full action |
1008 | BINARY(4) | Job message queue maximum size |
1012 | CHAR(10) | Job user identity |
1013 | CHAR(1) | Job user identity setting |
1014 | BINARY(4) | Job end reason |
1015 | CHAR(1) | Job log pending |
1016 | BINARY(4) | Job type - enhanced |
1017 | CHAR(8) | Job local time |
1018 | CHAR(10) | Job log output |
1201 | CHAR(3) | Language ID |
1202 | CHAR(1) | Logging level |
1203 | CHAR(10) | Logging of CL programs |
1204 | BINARY(4) | Logging severity |
1205 | CHAR(10) | Logging text |
1301 | CHAR(8) | Mode name |
1302 | BINARY(4) | Maximum processing unit time allowed |
1303 | BINARY(4) | Maximum temporary storage allowed, in kilobytes,
![]() ![]() |
1304 | BINARY(4) | Maximum threads |
1305 | BINARY(4) | Maximum temporary storage allowed, in megabytes |
1306 | CHAR(10) | Memory pool name |
1307 | CHAR(1) | Message reply |
1401 | BINARY(4) | Number of auxiliary I/O requests, if less than 2,147,483,647 |
1402 | BINARY(4) | Number of interactive transactions |
1403 | BINARY(4) | Number of database lock waits |
1404 | BINARY(4) | Number of internal machine lock waits |
1405 | BINARY(4) | Number of nondatabase lock waits |
1406 | BINARY(8), UNSIGNED | Number of auxiliary I/O requests |
1501 | CHAR(20) | Output queue name - qualified |
1502 | CHAR(2) | Output queue priority |
1601 | CHAR(10) | Print key format |
1602 | CHAR(30) | Print text |
1603 | CHAR(10) | Printer device name |
1604 | CHAR(10) | Purge |
1605 | BINARY(4) | Product return code |
1606 | BINARY(4) | Program return code |
1607 | CHAR(8) | Pending signal set |
1608 | BINARY(4) | Process ID number |
![]() |
BINARY(4), UNSIGNED | Peak temporary storage used, in megabytes
![]() |
![]() |
BINARY(8), UNSIGNED | QTEMP library size, in bytes
![]() |
1801 | BINARY(4) | Response time total |
1802 | BINARY(4) | Run priority (job) |
1803 | CHAR(80) | Routing data |
1901 | CHAR(20) | Sort sequence table - qualified |
1902 | CHAR(10) | Status message handling |
1903 | CHAR(10) | Status of job on the job queue |
1904 | CHAR(26) | Submitter's job name - qualified |
1905 | CHAR(20) | Submitter's message queue name - qualified |
1906 | CHAR(20) | Subsystem description name - qualified |
1907 | BINARY(4) | System pool identifier |
1908 | CHAR(10) | Special environment |
1909 | CHAR(8) | Signal blocking mask |
1910 | BINARY(4) | Signal status |
1911 | CHAR(30) | Server type |
1982 | CHAR(10) | Spooled file action |
2001 | CHAR(1) | Time separator |
2002 | BINARY(4) | Time slice |
2003 | CHAR(10) | Time-slice end pool |
2004 | BINARY(4) | Temporary storage used, in kilobytes,
![]() ![]() |
2005 | BINARY(4) | Time spent on database lock waits |
2006 | BINARY(4) | Time spent on internal machine lock waits |
2007 | BINARY(4) | Time spent on nondatabase lock waits |
2008 | BINARY(4) | Thread count |
2009 | BINARY(4), UNSIGNED | Temporary storage used, in megabytes |
2020 | CHAR(10) | Time zone current abbreviated name |
2021 | CHAR(50) | Time zone current full name |
2022 | CHAR(7) | Time zone current message identifier |
2023 | BINARY(4) | Time zone current offset |
2024 | CHAR(10) | Time zone description name |
2025 | CHAR(20) | Time zone message file name - qualified |
2026 | CHAR(1) | Time zone Daylight Saving Time indicator |
2101 | CHAR(24) | Unit of work ID |
2102 | BINARY(4) | User return code |
Usage Notes
The conditions under which this API is threadsafe are the same as those described in the Usage Notes for the Retrieve Job Information (QUSRJOBI) API.
Error Messages
Message ID | Error Message Text |
---|---|
CPF1865 E | Value &1 for job type not valid. |
CPF1866 E | Value &1 for number of fields to return not valid. |
CPF1867 E | Value &1 in list not valid. |
CPF24B4 E | Severe error while addressing parameter list. |
CPF3CB1 E | Value &1 for job status is not valid. |
CPF3CB2 E | Value specified for job parameter is not valid. |
CPF3CF1 E | Error code parameter not valid. |
CPF3C20 E | Error found by program &1. |
CPF3C21 E | Format name &1 is not valid. |
CPF3C36 E | Number of parameters, &1, entered for this API was not valid. |
CPF3C90 E | Literal value cannot be changed. |
CPF8100 E | All CPF81xx messages could be returned. xx is from 01 to FF. |
CPF9800 E | All CPF98xx messages could be signaled. xx is from 01 to FF. |
CPF9801 E | Object &2 in library &3 not found. |
CPF9802 E | Not authorized to object &2 in &3. |
CPF9803 E | Cannot allocate object &2 in library &3. |
CPF9807 E | One or more libraries in library list deleted. |
CPF9808 E | Cannot allocate one or more libraries on library list. |
CPF9810 E | Library &1 not found. |
CPF9820 E | Not authorized to use library &1. |
CPF9830 E | Cannot assign library &1. |
CPF9838 E | User profile storage limit exceeded. |
CPF9872 E | Program or service program &1 in library &2 ended. Reason code &3. |
API introduced: V1R3