The LBR$REPLACE_KEY routine modifies or inserts a key into the library. Format LBR$REPLACE_KEY library_index ,key_name ,oldrfa ,newrfa [, flags]
1 – Returns
OpenVMS usage:cond_value type: longword (unsigned) access: write only mechanism: by value Longword condition value. Most utility routines return a condition value. Condition values that this routine can return are listed under Condition Values Returned.
2 – Arguments
library_index OpenVMS usage:longword_unsigned type: longword (unsigned) access: read only mechanism: by reference Library control index returned by the LBR$INI_CONTROL routine. The library_index argument is the address of the longword that contains the index. key_name OpenVMS usage:char_string type: character string access: read only mechanism: by descriptor For libraries with ASCII keys, the key_name argument is the address of a string descriptor for the key. For libraries with binary keys, the key_name argument is the address of an unsigned longword value for the key. oldrfa OpenVMS usage:vector_longword_unsigned type: longword (unsigned) access: read only mechanism: by reference Old record file address (RFA). The oldrfa argument is the address of a 2-longword array containing the original RFA (returned by LBR$LOOKUP_KEY) of the module header associated with the key you are replacing. newrfa OpenVMS usage:vector_longword_unsigned type: longword (unsigned) access: read only mechanism: by reference New RFA. The newrfa argument is the address of a 2-longword array containing the RFA (returned by LBR$PUT_RECORD) of the module header associated with the new key. flags OpenVMS usage:mask_longword type: longword (unsigned) access: read only mechanism: by reference If present, the flags argument specifies the type of key being replaced. The flag bits are as follows: Flag Bits Description LBR$SYM_WEAK = 0x1 UNIX-style weak symbol attribute LBR$SYM_GROUP = 0x2 Group symbol attribute If this argument is not present, NonGroup-Global is the assumed type. In this case, all type lists are searched and the entries removed. The new symbol is placed in the new NonGroup-Global definition with newrfa as the defining module. If this parameter is present, it represents the flags set for the type of symbol being replaced. The replacement is done in place without losing its position in the type list. If the symbol does not exist when the call to this routine is made, the new definition is placed at the end of the type list for the specified type. Because there are now different symbol definition types, VSI advises using the LBR$DELETE_KEY routine followed by the LBR$INSERT_KEY routine when the old key and new key differ in definition type.
3 – Description
If LBR$REPLACE_KEY does not find the key in the current index, it calls the LBR$INSERT_KEY routine to insert the key. If LBR$REPLACE_KEY does find the key, it modifies the key entry in the index so that it points to the new module header.
4 – Condition Values Returned
LBR$_ILLCTL Specified library control index not valid. LBR$_INVRFA Specified RFA not valid. LBR$_LIBNOTOPN Specified library not open.