ADD_USER_INDEX_ENTRY and ADD_USER_INDEX_ENTRY_BINARY procedures
The ADD_USER_INDEX_ENTRY and ADD_USER_INDEX_ENTRY_BINARY procedures add a single entry to a user index (*USRIDX). The data to be added can be provided as either character or binary data.
For a fixed length index, the length of the new entry must exactly match the user index length or an error will occur.
The values used by the procedures are closely related to the values handled by the Add User Index Entries (QUSADDUI) API. Refer to the API documentation for additional behavior details.
Authorization: The caller must have:
- *EXECUTE authority to the library containing the user index, and
- *CHANGE authority to the user index.
The schema is QSYS2.
- user-index
- A character string containing the name of the user index where an entry is to be added.
- user-index-library
- A character string containing the name of the library where the user index is located. Can be
one of the following special values:
- *CURLIB
- The current library is used.
- *LIBL
- The library list is used.
- replace
- The type of add to be performed.
- NO
- For a non-keyed index, the new entry must be unique. If the entry is already in the index, an error is returned.
- YES
- For a non-keyed index, this value is not supported.
- entry
- A string that specifies the data for the index entry. This parameter is required.
- key
- A string that specifies the key for the index entry. This parameter must be provided for a keyed user index. The length of the key cannot exceed the defined key length.
Example
- Add a new entry to a non-keyed user index.
CALL QSYS2.ADD_USER_INDEX_ENTRY(USER_INDEX => 'IX1', USER_INDEX_LIBRARY => 'APPLIB', REPLACE => 'NO', ENTRY => 'Next entry');
- Add a new entry to a keyed user index. Allow the new entry to overwrite an existing entry if the
key value already exists.
CALL QSYS2.ADD_USER_INDEX_ENTRY(USER_INDEX => 'USRIX1', USER_INDEX_LIBRARY => 'APPLIB', REPLACE => 'YES', KEY => '00173', ENTRY => 'New keyed entry');