Retrieve User Index Entries (QUSRTVUI) API


  Required Parameter Group:

1 Receiver variable Output Char(*)
2 Length of receiver variable Input Binary(4)
3 Entry lengths and entry offsets Output Array(*) of Char(8)
4 Length of entry lengths and offsets Input Binary(4)
5 Number of entries returned Output Binary(4)
6 Returned library name Output Char(10)
7 Qualified user index name Input Char(20)
8 Format Input Char(8)
9 Maximum number of entries Input Binary(4)
10 Search type Input Binary(4)
11 Search criteria Input Char(*)
12 Length of search criteria Input Binary(4)
13 Search criteria offset Input Binary(4)
14 Error code I/O Char(*)

  Default Public Authority: *USE

  Threadsafe: Yes

The Retrieve User Index Entries (QUSRTVUI) API retrieves user index entries that match the criteria specified on the search criteria parameter.

The entries are always returned starting with the entry that is closest to or equal to the search criteria parameter and then proceeding away from the search criteria. The number of entries returned parameter will never exceed the value specified in the maximum number of entries parameter. Each entry retrieved from the user index is based on the binary value of the search criteria parameter. No other collating sequence is supported.

Every entry retrieved causes the number of retrieve operations to be incremented by 1.


Authorities and Locks

User Index Library Authority
*EXECUTE
User Index Authority
*USE
User Index Lock
*SHRUPD

Required Parameter Group

Receiver variable
OUTPUT; CHAR(*)

The variable that is to receive the information requested. You can specify the size of this area to be smaller than the format requested as long as you specify the length parameter correctly. As a result, the API returns only the data that the area can hold.

Use the entry lengths and entry offsets parameter to parse through this parameter. If the number of entries returned parameter is 0, then only the bytes available and the bytes provided have been changed.

To determine if all the entries are valid in the receiver variable, compare the bytes returned and bytes available fields. If the bytes returned are less than the bytes available, your receiver variable is not large enough to hold all the entries that match the search criteria parameter. While processing the entries, you need to make sure that both:

The size of the receiver variable parameter should be greater than or equal to:

 8 + (the maximum number of entries parameter
       * the maximum entry length)

The maximum entry length was defined when the index was created. It can be obtained by using the Retrieve User Index Attributes (QUSRUIAT) API.

Refer to the IDXE0100 Format for the layout of this parameter.

Length of receiver variable
INPUT; BINARY(4)

The length of the receiver variable. If the length is larger than the size of the receiver variable, the results may not be predictable. The minimum length is 8 bytes.

Entry lengths and entry offsets
OUTPUT; ARRAY(*) of CHAR(8)

A data structure containing entry lengths and entry offsets for all entries found that met the search criteria. An entry length and entry offset exist for every entry returned in the receiver variable. These entry lengths and entry offsets are used to parse through the receiver variable.

The size of the entry lengths and entry offsets parameter should be at least:

 8 + (the maximum number of entries parameter * 8)

You must provide enough space in both the receiver variable and the entry lengths and entry offsets parameter for this API to return this information to you. You will not receive complete information in the following two situations.

See the Format for Entry Lengths and Entry Offsets for details about the data structure.

Length of entry lengths and entry offsets
INPUT; BINARY(4)

The length of the entry lengths and entry offsets parameter. If the length is longer than the entry lengths and entry offsets parameter, the results may not be predictable. The minimum length is 8.

If the receiver variable cannot hold all the entries that satisfy the search criteria:

Number of entries returned
OUTPUT; BINARY(4)

The total number of index entries found that satisfy the search criteria. If this field is 0, no entries satisfied the search criteria. This value can never be greater than the maximum number of entries parameter.

Returned library name
OUTPUT; CHAR(10)

The name of the library that contains the user index from which the entries were successfully retrieved. This parameter is not set if an error occurs.

Qualified user index name
INPUT; CHAR(20)

The user index for which you want to retrieve information, and the library in which it is located. The first 10 characters contain the user index 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
INPUT; CHAR(8)

The format of the receiver variable.

The format name supported is:

IDXE0100 Basic Information

Refer to IDXE0100 Format for details about the format.

Maximum number of entries
INPUT; BINARY(4)

The maximum number of index entries to be returned that match the search criteria. Valid values are 1 through 4095.

Search type
INPUT; BINARY(4)

The type of search that is to be performed.

Valid values are:

1 Equal

Find entries that are equal to the searcg criteria.

2 Greater than

Find entries that are greater than the search criteria.

3 Less than

Find entries that are less than the search criteria.

4 Greater than or equal

Find entries that are greater than or equal to the search criteria.

5 Less than or equal

Find entries that are less than or equal to the search criteria.

6 First

Find the first index entry or entries.

7 Last

Find the last index entry or entries.

8 Between

Find all entries between the two arguments specified in the search criteria.


Search criteria
INPUT; CHAR(*)

The criteria used to find matches in the user index.

If the search type is 8 (between), both search elements must have the same length. When the search type is 8 (between), this parameter contains two search elements. The first element is considered the starting element, and the second element is the ending element.

This parameter is ignored when the search type parameter is 6 (first) or 7 (last).

Length of search criteria
INPUT; BINARY(4)

The length of the search criteria that is to be used. This parameter is ignored when the search type is 6 (first) or 7 (last).

If the search type is 8 (between), this parameter specifies the length of the first element. The second element must have the same length as the first element. Valid values are 1-2000, depending on how the user index was created.

For a fixed and keyed user index, the length of the search criteria:


Search criteria offset
INPUT; BINARY(4)

The offset of the second search element from the beginning of the search criteria parameter. This parameter is ignored unless the search type is 8 (between).

Error code
I/O; CHAR(*)

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


Format for Entry Lengths and Entry Offsets

The following information is returned in the entry lengths and entry offsets parameter. The information is needed to parse through the receiver variable. For detailed descriptions of the fields in the table, see Field Descriptions.

Offset Type Field
Dec Hex
0 0 BINARY(4) Bytes returned
4 4 BINARY(4) Bytes available
Note: The following fields will be repeated. The number of times they are repeated depends on the length of the entry lengths and entry offsets parameter and the number of entries actually retrieved.
    BINARY(4) Entry length
    BINARY(4) Entry offset


IDXE0100 Format

The following index information is returned for the IDXE0100 format in the receiver variable parameter. For detailed descriptions of the fields in the table, see Field Descriptions.

Offset Type Field
Dec Hex
0 0 BINARY(4) Bytes returned
4 4 BINARY(4) Bytes available
8 8 CHAR(*) Entry 1-n


Field Descriptions

Bytes available. The length of all data available to return. All available data is returned if enough space is provided.

Bytes returned. The length of the data actually returned.

Entry length. The length of the entry retrieved from the index. Valid values are 1-2000, depending on how the user index was created.

Entry offset. The number of bytes from the beginning of the immediately preceding entry to the first byte of the entry returned. For the first entry, the offset is the number of bytes from the beginning of the receiver variable to the first byte of the first entry.

Entry 1-n. All entries that satisfy the search criteria (up to the maximum number of entries parameter) are returned. User indexes are created to contain only scalar data, which results in the index entries being contiguous. Use the entry length and entry offset values to parse this field.

This field is repeated by the value in the number of entries returned parameter if the receiver variable is large enough to hold all of the entries found.


Error Messages

Message ID Error Message Text
CPF24B4 E Severe error while addressing parameter list.
CPF3CF1 E Error code parameter not valid.
CPF3CF2 E Error(s) occurred during running of &1 API.
CPF3C19 E Error occurred with receiver variable specified.
CPF3C21 E Format name &1 is not valid.
CPF3C24 E Length of the receiver variable is not valid.
CPF3C7A E Search type &1 is not valid.
CPF3C7D E Remove or search information is not valid.
CPF3C76 E Length of lengths and offsets of entries &1 is not valid.
CPF3C78 E Criteria length &1 is not valid.
CPF3C79 E Maximum number of entries &1 is not valid.
CPF3C90 E Literal value cannot be changed.
CPF8100 E All CPF81xx messages could be returned. 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: V2R3

[ Back to top | Object APIs | APIs by category ]