Transaction Error Handling

Error codes associated with transaction management are stored in a special register called TRANSACTION-STATUS. These codes tell you the status of the last transaction and are documented in Transaction Error Codes. Transaction management errors fall into two categories:

The TRANSACTION-STATUS variable has the same format as a file's status variable. It is automatically created by the compiler, and is implicitly shared by all programs of a run unit. TRANSACTION-STATUS is a reserved word.

You can specify procedures for transaction error handling with the USE statement and the reserved word TRANSACTION. The syntax is:

USE AFTER STANDARD {EXCEPTION} PROCEDURE ON TRANSACTION
                   {ERROR    }

If TRANSACTION is specified, the procedure executes when an error occurs during a START TRANSACTION, COMMIT, ROLLBACK, or call to C$RECOVER.

A transaction error 10 is returned by a START TRANSACTION statement when the LOG-FILE configuration variable (that specifies the default log file) is undefined. The COBOL program may choose to ignore this error in the cases where the filename-LOG variables are used.

A transaction error 99 is returned by a START TRANSACTION statement when one of the host file systems in effect does not support transaction management. The runtime includes the RM/COBOL file handler (RMFM) as default, which does not support transactions. Even though you receive this warning message, the Vision file handler will continue to process transactions as expected. If your program does not rely on the RM/COBOL file handler, you can safely remove it from the runtime by setting the RMFM-DETACH 1 configuration variable, after which, you will not receive the warning.