useTransaction and startTransaction script operations
You use the useTransaction and startTransaction script
operations to run operations within a transaction.
- useTransaction
- Runs the statements in a transaction. Rolls back if an error occurs.
- startTransaction
- Runs the statements in a transaction. Rolls back if an error occurs. Does not do anything if a transaction is already open.
startTransaction is similar to useTransaction, however, if
startTransaction discovers it is already within a transaction, it will not
interfere with the ongoing transaction, and merely runs the wrapped instructions.
useTransaction commits the currently open transaction.
If an error occurs within a startTransaction, it initiates its own rollback and
passes up the exception. If the startTransaction were nested inside another
startTransaction or even a useTransaction, this script operation
continues to chain upwards. Eventually the place where IBM® Product Master started the script is aware the script
failed, and can take appropriate action.
In addition, you can use the inTransaction() script operation to determine
whether the script code is running within a transaction.