Open List of Threads (QWCOLTHD) API


  Required Parameter Group:


  Default Public Authority: *USE

  Threadsafe: Yes.

The Open List of Threads (QWCOLTHD) API generates a list of active threads for the job specified in the Job identification parameter. The list may be sorted depending on the value of the sort parameter. Upon successful completion of this API, a handle is returned in the list information parameter. You may use this handle on subsequent calls to the following APIs:


Authorities and Locks

None.

Required Parameter Group

Receiver variable
OUTPUT; CHAR(*)

The variable that is used to return the list of active thread information.

Length of receiver variable
INPUT; BINARY(4)

The length of the receiver variable.

Format name
INPUT; CHAR(8)

The format of the thread list to be returned. The performance varies depending on the number of fields selected. The possible format names follow:

See Format of Receiver Variable for more information.

Receiver variable definition information
OUTPUT; CHAR(*)

The variable that is used to return the description of how the keyed portion of the list is returned in the receiver variable. See Format of Receiver Variable Definition Information for a description of the layout of this parameter.

Length of receiver variable definition information
INPUT; BINARY(4)

The length of the receiver variable definition information. This must be large enough to hold the information for all key fields that are specified in the key of fields to be returned parameter.

Job identification information
INPUT; CHAR(*)

The information that is used to identify the job for which the list of threads is to be returned. See Format of Job Identification Information for details.

Format of job identification information
INPUT; CHAR(8)

The format of the job identification information. The possible format name is:


List Information
OUTPUT; CHAR(80)

Information about the list that is created by this program. For a description of the layout of this parameter, see Open list information format.

Number of records to return
INPUT; BINARY(4)

The number of records in the list to put into the receiver variable after sorting has been done.

Sort information
INPUT; CHAR(*)

Information on what fields within the record of information to sort. See Format of Sort Information for a description of the layout of this parameter.

Number of fields to return
INPUT; BINARY(4)

The number of fields to return. If this parameter is 0, the key of fields to be returned parameter is not used, the receiver variable definition information parameter is not modified, and the length of receiver variable definition information must be 0.

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

The list of the fields to be returned. For a list of the valid key fields, see List of Keys Supported for Format OLTH0100.

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. The following special values may be specified:


General return data
OUTPUT; CHAR(*)

General output information that applies to the list of threads returned. See General Return Data for a description of the data returned.

Length of general return data
INPUT; BINARY(4)

The length of the general output information. The general output information field must be a minimum of 8 bytes.

Error code
I/O; CHAR(*)

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


Format of Receiver Variable

The following tables describe the order and format of the data that is returned in the receiver variable.


OLTH0100 Format



Field Descriptions

Data. The data returned for the key field.

Reserved. An ignored field.

Thread handle. A value that is used to address a particular thread within a job. A valid thread handle must be specified. The thread handle is returned on several other interfaces.

Thread identifier. A value that is used to uniquely identify a thread within a job. A valid thread identifier must be specified.

Total length of data returned. The length of the data portion of the returned data. This includes the sum of all the keyed data for the list of threads.


Format of Receiver Variable Definition Information



Field Descriptions

Displacement to data. The displacement from the beginning of the thread record in the receiver variable to the value for this key.

Key field. The field returned. See List of Keys Supported for Format OLTH0100 for the list of valid keys supported for the OLTH0100 format.

Length of data. The length of the data returned for the field.

Length of field information returned. The total length of definition 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 in each record that is returned to the application.

Reserved. An ignored field.

Type of data. The type of data that is returned.



Format of Sort Information



Field Descriptions

Number of keys to sort on. The number of fields within the record structure on which to sort. If 0 is specified, the list is not sorted.

Reserved. Reserved field. This field must be set to hexadecimal or binary zero.

Sort key field data type. Data type of field to sort. See Sort (QLGSORT) API for information on the list of data types available.

Sort key field length. The length of the field on which to sort.

Sort key field starting position. Within the record of information, the starting position of the field to sort on. A value of 1 represents the first position within the record.

Sort order. Whether the list should be sorted in ascending or descending order according to the key.



Format of Job Identification Information

The format of the information needed to identify the job for which the list of threads will be returned.

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 hex zeros.

Thread identifier. An unused field on this API. This field must contain hex zeros.

Thread indicator. An unused field on this API. This field must contain hex zeros.

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


General Return Data



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.

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.

Internal job identifier. A value that is sent to other APIs to speed the process of locating the job on the system. The identifier is not valid following an initial program load (IPL). If you attempt to use it after an IPL, an exception occurs.

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 workstation where the job started. For a batch job, you specify the name in the command when you submit the job.

Job number used. The system-assigned job number.

Reserved. An ignored field.

User name used. 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.


List of Keys Supported for Format OLTH0100

When the length of the data returned for a key is not a multiple of 4 bytes, the length of the field information returned is adjusted so that the next key begins on a 4-byte boundary. This adjustment should be considered when calculating the starting position of a key field to sort on.


Field Descriptions

The field descriptions are in Work Management API Attribute Descriptions (WMAttrDesc).


Usage Notes

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 ]