gtpc3m0e | Concepts and Structures |
TPF transaction services support provides an interface for application programmers to ensure the integrity of the database. The TPF system uses a subset of the X/Open TX interface to begin and end a commit scope, which is a unit of work that groups together a set of database updates. With TPF transaction services processing, either all file updates have been completed or none of them have; that is, the updates can be either written to the DASD surface as a group at the same time or rejected as a group where no hardening (writing to the DASD surface) takes place. You never have to worry about a partially updated database.
An application programmer explicitly defines the start of the commit scope
(commonly referred to as a begin transaction)
and the end of the commit scope (commonly referred to as a commit
or rollback transaction).
Once a commit scope begins, updates to the database are stored in a commit
scope buffer where they remain until the commit scope ends. A commit
scope ends when the data is committed to the database or discarded (rolled
back). None of the file changes are reflected in the database if the
commit scope is rolled back. Following are the operations that permit
the application to begin and end a transaction:
Table 1. TPF Transaction Services Begin and End Transactions
C Function | Assembler Macro |
---|---|
tx_begin | TXBGC |
tx_commit | TXCMC |
tx_rollback | TXRBC |
Additionally, the TPF system provides the following extensions of the
X/Open interface to the application to suspend or resume a transaction:
Table 2. TPF Transaction Services Suspend and Resume Transactions
C Function | Assembler Macro |
---|---|
tx_suspend_tpf | TXSPC |
tx_resume_tpf | TXRSC |
The activity in the commit scope does not affect activities outside the commit scope until the scope is committed or, in the case of nested commit scopes, until the root scope is committed. A nested scope occurs when an application programmer begins a transaction (opens a commit scope) before ending the previous commit scope. In this case, the file updates that are committed or ended by the nested scope are still not seen by any other ECBs until the root commit scope ends. The root scope is what the first, or highest level, commit scope is known as.
At the system level, TPF transaction services includes support for a transaction manager, resource managers, log manager, and recovery log to ensure a consistent view of the database.