Start of change

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.
Read syntax diagramSkip visual syntax diagramADD_USER_INDEX_ENTRYADD_USER_INDEX_ENTRY_BINARY( USER_INDEX => user-index,USER_INDEX_LIBRARY => user-index-library,REPLACE => replace,ENTRY => entry,KEY => key)

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.
For a keyed index, insert the entry only if the key is not already in the user index. If the entry does not exist, the key and entry data will be inserted into the user index. If the entry is already in the index, an error is returned.
YES
For a non-keyed index, this value is not supported.
For a keyed index, replace the entry portion of the index entry if the key is already in the user index. If the entry does not exist, the key and entry data will be inserted into the user index.
entry
A string that specifies the data for the index entry. This parameter is required.
  • For ADD_USER_INDEX_ENTRY, the input value is a character string.
  • For ADD_USER_INDEX_ENTRY_BINARY, the input value will be considered a binary string.
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.
  • For ADD_USER_INDEX_ENTRY, the input value is a character string.
  • For ADD_USER_INDEX_ENTRY_BINARY, the input value will be considered a binary string.
If the index is not keyed, this parameter must be omitted.

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');
    
End of change