Update (3)
The Update operation (B_UPDATE) changes the information in an existing record.
Parameters
 
*Note: When using the no-currency-change (NCC) option, the Update operation does not update the value of the Key Buffer parameter; it does not return any information in that parameter.
Prerequisites
Procedure
1
2
3
4
5
When performing a non-NCC Update operation immediately following a Get operation, pass the Key Number exactly as the transactional interface returned it on the Get operation; otherwise, the transactional interface updates the record successfully but returns Status Code 7 on the first Get operation performed after the update.
Result
If the Update operation is successful, the transactional interface updates the record stored in the file with the new value in the Data Buffer, adjusts the indexes to reflect any change in the key values, and returns the value of the specified key in the Key Buffer. An NCC Update operation does not update the value of the Key Buffer parameter.
If the application holds a single-record lock on the record to be updated, the transactional interface releases the lock. However, a multiple-record lock is never released by an Update operation.
If the Update operation is unsuccessful, the transactional interface returns one of the following status codes:
Positioning
The Update operation and the NCC Update operation do not affect physical currency.
An Update operation that does not use the NCC option can affect logical currency if the value of the updated key repositions the record in the index. For example, suppose an INTEGER key’s logical current record has a value of 1. For that same key, the logical next record has a value of 2. If you update 1 to 4, you no longer have the same logical next record. In this example, after the Update operation, the logical next record has a value that is greater than 4.
An NCC Update operation does not affect logical currency. This means that an application, having performed an NCC Update operation, has the same logical position in the file as it had prior to the Update operation. In such a situation, operations that follow an NCC Update—such as Get Next (6), Get Next Extended (36), Get Previous (7), and Get Previous Extended (37)—return values based on the application’s logical currency prior to the NCC Update.
*Note: The transactional interface does not return any information in the Key Buffer parameter as the result of an NCC Update operation. Therefore, an application that must maintain the logical currency must not change the value of the Key Buffer following the NCC Update operation. Otherwise, the next Get operation has unpredictable results.