6.68 LceUpdate

This function updates an existing record in a file. The list of fields to be updated is specified in a list.







 char far *




 char far *




 char far *





fValidate )




The session identifier as returned by LceGetSessionId.


A list of fields to be updated. These fields must have been declared using an LceUseField function. Only the fields specified in this list will be updated.  The value for each of the fields in the list must be set using the LceSetFieldValue/LceSetFieldValueU function.


The name of the file. This file must have been declared using an LceUseFile function.


A list of key field names. The fields must have been declared using an LceUseField function. The values for the keys are set using the LceSetFieldValue/LceSetFieldValueU function. Refer to the Notes for the benefits of leaving this key list blank.


This parameter provides a " check but do not update" facility.

True = Perform validate only.

False = Perform update immediately.


Return Values

TRUE is returned if the session has updated or can update the record.

FALSE is returned if an error occurs.


When multiple users are working with a file, it is likely that two users will want to update the same record at the same time. LANSA Open will handle this situation automatically if you leave the strKeyList blank. In this case, if a user attempts to update a record which has already been changed by another user, LANSA Open issues an appropriate message and does not perform the update.

Because LANSA Open does this check for you, record locking on the host is unnecessary.

If you specify a key, then that record will be updated regardless of whether it has been changed since it was selected.

If you do specify keys, you do not have to use the complete key list. For example, you could use the first two fields in a file with three key fields. You must always use the keys in the correct order. If you use a subset of the key fields, you are implicitly using a "generic select" on the unspecified keys, i.e. match key1 and key2 while key3 can have any value. In this case, you are requesting that all records which match the partial key are updated. If you specify a unique key, you will perform an update of a single record.


By creating the proper validation rules in the Repository, you can use LANSA to perform referential integrity checks for you. For example, the Repository's rules could specify that an order's details can only be changed if the order flag indicates that the order hasn't already been shipped. The relevant error message can also be stored in the Repository and displayed using LANSA Open's automated error message facility.

Related Functions

6.71 LceUseFile

6.58 LceSetFieldValue

6.59 LceSetFieldValueU

6.43 LceInsert

6.10 LceDelete

6.8 LceCheckFor