Retrieve Thread Attribute (QWTRTVTA) API


  Required Parameter Group:


  Default Public Authority: *USE

  Threadsafe: Conditional; see Usage Notes.

The Retrieve Thread Attribute (QWTRTVTA) API retrieves job and thread attributes that apply to the job or thread specified in the job or thread identification information parameter.


Authorities and Locks

The following authority restrictions apply only when the API is called for format name RTVT0200. All other format names have no authority restrictions.

Job Authority
When calling this API for format name RTVT0200, one of the following conditions must be met:

  • The API must be called from within the job for which the information is being 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. 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.

  • The caller of the API must be running under a user profile that has job control (*JOBCTL) special authority.

  • The caller of the API must be authorized to the Thread Control function of the IBM® i operating system through System i™ Navigator's Application Administration support. The Change Function Usage Information (QSYCHFUI) API, with a function ID of QIBM_SERVICE_THREAD, can be used to change the list of users that are allowed to retrieve information about a thread.

Required Parameter Group

Receiver variable
OUTPUT; CHAR(*)

The variable that is used to return the attribute information for the specified thread.

Length of receiver variable
INPUT; BINARY(4)

The length of the receiver variable provided. The length of receiver variable parameter may be specified up to the size of the receiver variable specified in the user program. If the length of receiver variable parameter specified is larger than the allocated size of the receiver variable specified in the user program, the results are not predictable. The minimum length is 8 bytes.

Format of receiver information
INPUT; CHAR(8)

The format of the information returned in the receiver variable. The possible format name is:


Job or thread identification information
INPUT; CHAR(*)

The information that is used to identify the job or thread within a job for which attribute information is to be returned. See Format of Job or Thread Identification Information for details.

Format of job or thread identification information
INPUT; CHAR(8)

The format of the job or thread identification information. The possible format names are:


Number of fields to return
INPUT; BINARY(4)

The number of fields to return in the specified format.

Key of fields to be returned
INPUT; ARRAY(*) of BINARY(4)

The list of fields to be returned in the specified format. For a list of valid fields, see Valid Keys.

Reset status statistics
INPUT; CHAR(1)

The elapsed time and all the key fields that are based on the elapsed time are reset to zero. If a format other than RTVT0300 is specified, this field needs to be zero. The following special values may be specified:


Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter.


Format RTVT0100

The RTVT0100 format returns job or thread attribute information for the specified thread. For the list of keys that are valid for job attributes and thread attributes, see Keys for RTVT0100.



Field Descriptions

Bytes available. The number of bytes of data available to be returned. All available data is returned if enough space is provided.

Bytes returned. The number of bytes of data returned.

Data. The data returned for the key field.

Job name. 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. The system-assigned job number.

Job status. The status of the job. The valid values are:

Key field. The field returned. See Valid Keys for the list of valid keys.

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.

Offset to key fields. The offset in characters (bytes) from the beginning of the receiver to the key fields array entry.

Reserved. An ignored field.

Returned thread handle. A value which addresses a particular thread within the job. While the thread identifier uniquely identifies the thread within the job, the thread handle can improve performance when referencing the thread. This field will be 0 when called to return attributes for a job.

Returned thread identifier. A value which uniquely identifies the thread within the job. This field will be 0 when called to return attributes for a job.

Type of data. The type of data returned.

User name. The user profile under which the job is started. The user name is the same as the user profile name and can come from several different sources depending on the type of job.


RTVT0200 Format

The RTVT0200 format returns library list information for the specified thread. The special value of -1 for the thread indicator field (part of the JIDF0100 format) may not be used. For the list of keys that are valid for this format, see Keys for RTVT0200.



Library Array Entry

The library array entry describes the data that is returned for each library entry in the array of libraries. The name of the library as well as some extended information about the library is returned with this format.

For details about the fields listed, see Field Descriptions.



ASP Group Information Entry

The ASP group information entry describes the data that is returned for each ASP group. The name of the ASP group is returned with this format. For details about the fields listed, see Field Descriptions.



Field Descriptions

ASP group information. The list of Auxiliary Storage Pool (ASP) group information for the current thread. This information does not include the system ASP or the basic user ASPs.

ASP group name. The name of an ASP group being used by the thread. This is the name of the primary ASP device in an ASP group.

Bytes available. All of the available bytes for use in your application.The actual length depends on how many libraries are in the library list.

Bytes returned. The number of bytes returned to the user. This may be some but not all of the bytes available.

Current library. The name of the current library for the specified thread. If no current library exists, the number of current libraries field is zero and this field has no entry in the list.

Job name. 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. The system-assigned job number.

Length of one ASP group information entry. The length of an entry in the ASP group information. Zero indicates that ASP group information is not being returned.

Length of one library array entry. The length of an entry in one of the library list entries.

Library ASP name. The name of the ASP in which the library is located. The following special values may also be returned:

Library ASP number. The numeric identifier of the ASP device containing the object's library. The following values may be returned:

Library name. The name of the library object.

Library text description. The text description of the library object. This field is blank if no text description is specified.

Number of ASP group information entries. The number of elements in entries in the ASP group information. Zero indicates that ASP group information is not being returned.

Number of current libraries. The number of libraries in the current part of the library list of the specified thread.

Number of product libraries. The number of product libraries found in the library list of the specified thread.

Number of system libraries. The number of libraries in the system part of the thread's library list. This value will be zero if system libraries were not requested.

Number of user libraries. The number of libraries in the thread's user library list. This value will be zero if user libraries were not requested.

Offset to ASP group information. The offset in characters (bytes) from the beginning of the receiver to the first ASP group information entry. Zero indicates that ASP group information is not being returned.

Offset to current library. The offset in characters (bytes) from the beginning of the receiver to the current library array entry.

Offset to libraries in product library list. The offset in characters (bytes) from the beginning of the receiver to the first product library array entry.

Offset to libraries in system library list. The offset in characters (bytes) from the beginning of the receiver to the first system library array entry.

Offset to libraries in user library list. The offset in characters (bytes) from the beginning of the receiver to the first user library array entry.

Product libraries. The libraries that contain product information for the specified thread. If no product libraries exist, the number of product libraries field is zero and this field has no entry in the list.

Reserved. An ignored field.

Returned thread handle. A value which addresses a particular thread within the job. While the thread identifier uniquely identifies the thread within the job, the thread handle can improve performance when referencing the thread.

Returned thread identifier. A value which uniquely identifies the thread within the job.

System library list. The system portion of the library list of the specified thread.

User library list. The user portion of the library list for the specified thread.

User name. The user profile under which the job is started. The user name is the same as the user profile name and can come from several different sources depending on the type of job.


Format RTVT0300

The RTVT0300 format returns performance statistics information, calculated over an elapsed time, for the specified thread. The special value of -1 for the thread indicator field (part of the JIDF0100 format) may not be used. For the list of keys that are valid for this format, see Keys for RTVT0300.



Field Descriptions

Bytes available. The number of bytes of data available to be returned. All available data is returned if enough space is provided.

Bytes returned. The number of bytes of data returned.

Data. The data returned for the key field.

Elapsed time. The time, in milliseconds, that has elapsed between the measurement start time and the current system time. This value is 0 the first time this API is called by this job. The measurement start is set the first time this API is called and when the reset status statistics is set to reset the elapsed time.

Job name. 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. The system-assigned job number.

Key field. The field returned. See Valid Keys for the list of valid keys.

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.

Reserved. An ignored field.

Returned thread handle. A value which addresses a particular thread within the job. While the thread identifier uniquely identifies the thread within the job, the thread handle can improve performance when referencing the thread.

Returned thread identifier. A value which uniquely identifies the thread within the job.

Type of data. The type of data returned.

User name. The user profile under which the job is started. The user name is the same as the user profile name and can come from several different sources depending on the type of job.


Format of Job or Thread Identification Information

Format JIDF0100 is the format of the information needed to identify the job or the thread for which the job or thread's attributes will be returned. This format is to be used for returning job or thread information. This format supports several special values that can help in identifying the thread.

Format JIDF0200 is the format of the information needed to identify the thread for which the thread's attributes will be returned. This format is to be used when referencing a specific thread that you already have the identification information for.

Note: If the thread handle is available, Format JIDF0200 provides a faster method of accessing a thread that is not the current thread than Format JIDF0100.


JIDF0100 Format



Field Descriptions

Internal job identifier. The internal identifier for the job. The List Job (QUSLJOB) API returns this identifier. If you do not specify *INT for the job name parameter, this parameter must contain blanks. With this parameter, the system can locate the job more quickly than with a job name.

Job name. A specific job name or one of the following special values:

Job number. A specific job number, or blanks when the job name specified is a special value.

Reserved. An unused field. This field must contain hexadecimal zeros.

Thread identifier. A value that uniquely identifies a thread within a job. If a thread identifier is specified, a thread indicator must also be specified. If the thread indicator is not 0, this field must contain hexadecimal zeros.

Thread indicator. A value that is used to specify the thread within the job for which information is to be retrieved. If a thread indicator is specified, a thread identifier must also be specified. The following values are supported:

Note: For all of the supported values, the combination of the internal job identifier, job name, job number and user name fields must also identify the job containing the thread.

User name. A specific user profile name, or blanks when the job name specified is a special value.


JIDF0200 Format



Field Descriptions

Internal job identifier. The internal identifier for the job. The List Job (QUSLJOB) API returns this identifier. If you do not specify *INT for the job name parameter, this parameter must contain blanks. With this parameter, the system can locate the job more quickly than with a job name.

Job name. A specific job name or one of the following special values:

Job number. A specific job number, or blanks when the job name specified is a special value.

Reserved. An unused field. This field must contain hexadecimal zeros.

Thread handle. A value that addresses a particular thread within a job. While the thread identifier uniquely identifies the thread within the job, the thread handle can improve performance when referencing the thread. A valid thread handle must be specified. The thread handle is returned on several other interfaces.

Thread identifier. A value which uniquely identifies a thread within a job. A valid thread identifier must be specified.

User name. A specific user profile name, or blanks when the job name specified is a special value.


Valid Keys

The following tables indicate the valid keys for the formats specified.


Keys for RTVT0100

The following table contains a list of the valid keys for format RTVT0100. See Key Field Descriptions for the descriptions of the valid key attributes. This table contains the keys that are valid for job attributes and thread attributes.

The Scope column defines the location of the attribute. The attribute is either scoped to the job or to the thread. If a job scoped attribute is requested for a thread, the value from the job containing the thread will be returned. If a thread scoped attribute is requested for a job, the value from the initial thread will be returned.



Format of ASP Group Information

The ASP group information describes the data that is returned for key 104 from the RTVT0100 format.



Format of ASP Group Information Entry

The ASP group information entry describes the data that is returned for each ASP group. The name of the ASP group is returned with this format.



Keys for RTVT0200

The following table contains a list of the valid keys for format RTVT0200. See Key Field Descriptions for the descriptions of the valid key attributes.

All the library keys are scoped to the thread. See Library Array Entry for format of library array entry. These keys are valid only when retrieving the library list of a specific thread. The special value of -1 for the thread indicator field (part of the JIDF0100 format) may not be used. The job or thread identification format must specify a specific valid thread.



Keys for RTVT0300

The following table contains a list of the valid keys for format RTVT0300. See Key Field Descriptions for the descriptions of the valid key attributes. All keys specified in this table are scoped to the thread. The special value of -1 for the thread indicator field (part of the JIDF0100 format) may not be used. The job or thread identification format must specify a specific valid thread.



Key Field descriptions

The descriptions of all the valid key attributes are described in Work Management API Attribute Descriptions (WMAttrDesc).


Usage Notes

The conditions under which this API is threadsafe are as follows:

When collecting performance statistics, it is important to provide an adequate time interval. The reported values reflect both the performance of the job that the API is looking at and the performance of the job that the API is running in. For example, you may see percentages greater than 100% because of the way the API interacts with the job that it is sampling.


Error Messages



API introduced: V5R2

[ Back to top | Work Management APIs | APIs by category ]