There are several situations where a rollback is automatically performed in order to help protect the integrity of an application database. These situations are as follows:

  1. When the operator uses the Break key and the interrupt is not disabled.

  2. When a timeout occurs while waiting for operator input.

  3. When it can be detected that the connection to the operator's terminal is lost.

  4. When an attempt to commit fails.

  5. If an individual PROIV process aborts, a rollback is performed either by PROIV itself or by DBMS/file system processes. In environments where the rollback must be performed by PROIV, it will occur only for externally requested, 'controlled' aborts.

  6. When an attempt is made to regen a function within a transaction.

  7. When a PROIV runtime error occurs,  it may impact application data integrity. Deadlocks and lock timeouts give rise to errors in this category (and a DBMS or file system may force a rollback for these cases anyway).

In all these situations, the current PROIV function is terminated. In cases 4 through 7 control is passed to a rollback link function to help the application developer or end-user determine the cause of the problem.

The rollback link function is stored in the system variable @RFUNCT, which can be altered in logic. The initial setting of this variable is the string '@RFUNCT' and an example function of this name is supplied with PROIV.

In the case of write errors, specifically errors 018 (error in writing file) and 019 (error in deleting record in file), it is possible to prevent an automatic rollback by suppressing the error.  This can be done using the DSELF statement in after-write-error logic. The @SYSERRsystem variable can be tested in after-write-error logic in order to detect specific errors (for example a duplicate key) but its contents will depend on the file system or DBMS in use.

Failure of a rollback is an error with severe implications for application data integrity. In the unlikely event that this problem occurs, the PROIV session is terminated immediately with a warning message of the form Process aborting due to Rollback failure.

Comment on this topic

Topic ID: 720014