Form calls the user edit routine with the type parameter equal to U_UPDATE when form enters the UPDATE mode. The other parameters are NULL. U_UPDATE indicates that the user wishes to update the current record displayed. The user edit routine can inspect the current record using the sread function and decide if the record should be updated. If an error message is returned, the operator will not be able to update the record.
When the operator starts a record update with the UPDATE key, form guarantees that the record will be stored with the STORE key, either by the operator or automatically generated by form. This is guaranteed even if no changes are made to the record while in update mode, or the operator presses the CANCEL key. This means that at the time the UPDATE key is pushed, you can back out any file updates the user edit routine made when the record was originally stored. For example, the user edit routine might update balances contained in other RMSfiles each time a record is stored. Then, when the operator updates a record using the UPDATE key, the user edit routine would back the current transaction out of the RMSfiles. When the operator presses the STORE to store the updated values back into the RMSfile, the user edit routine would again update the balances in the other RMSfiles using the new data values contained in the updated data record.
In UPDATE mode, the operator can push the UPDATE key again to put on the screen the original contents of the record. This allows the user to get back the original contents if the update is botched. The user edit routine is not called with the type parameter set to U_UPDATE when this re-update function is done. Internally, form imitates the user changing each input field to its original contents. The user edit routine is only called if there are any screen fields with the user edit field in the field description form set to yes.
The record to be updated is locked before the user edit routine is called and remains locked until after the user edit routine is called again for the STORE key.