Change Verify

The DP4 change verify facility prevents a record from being updated twice if it is in contention . If an update fails because a record has been updated by another user and your program does not provide a way to recover from the situation, the program will halt and any pending transactions will be lost.

You can use the change verify facility to handle an update failure in two ways:

If you choose to provide a recovery routine, you should test the variable fail_code which is returned after an attempted update. Use the value of the return code to determine whether the recovery routine is executed:

0 Update successful
3 Contention failure on one of the records
4 Orphan check failure
5 One of the records updated was locked by another user

The fail code is returned at the end of a procedure body which secures changes. In applications which use the private database, the code is returned only when records are updated to the public database.

You may display a fail message following an unsuccessful attempt to update the database, depending on your answer to the Suppress update fail messages question.

To halt the program if an update fails:

In the Program Summary answer yes to the question Stop program if update fails ?

To display an error message and continue if an update fails:

  1. In the Program Summary answer no to the question Stop program if update fails ?
  2. To provide automatic fail messages, set the Suppress fail messages question on the Program Summary to No

To provide a recovery routine if an update fails:

  1. In the Program Summary set the Stop Program option to No
  2. Add a procedure body to display a specific message and perform any recovery actions under the procedure that is likely to fail. The condition to enter should test the value of fail_code.