Introduction to Data Management
Ensuring Database Consistency With TMF
15873 Tandem Computers Incorporated 7-5
Figure 7-3. TMF Transaction in a SCREEN COBOL Program
S8020-023
From DDL
From PATHAID
IDENTIFICATION DIVISION.
ENVIRONMENT DIVISION.
SPECIAL-NAMES.
ENTER-KEY IS F1, EXIT-KEY IS F16.
DATA DIVISION.
WORKING-STORAGE SECTION.
LINKAGE SECTION.
SCREEN SECTION
SCREEN MAPPING
PROCEDURE DIVISION.
DISPLAY BASE CUSTOMER-ENTRY.
ACCEPT CUSTOMER-SCREEN UNTIL ENTER-KEY
ESCAPE ON EXIT-KEY, TIMEOUT 600.
BEGIN-TRANSACTION
PERFORM ONE OF
ADD-CUSTOMER,
RESET-SCREEN,
OPERATOR-TIMEOUT DEPENDING ON TERMINATION-ST.
END-TRANSACTION
ADD-CUSTOMER
SEND CREDIT-CHECK-MSG TO "CREDIT CHECK"
REPLY CODE 1 YIELDS CREDIT-OK
CODE 2 YIELDS CREDIT-BAD
CODE 3 YIELDS STOLEN.
.
.
.
TMF treats the entire transaction bracketed by these statements as a single, discrete
unit of recovery. At the onset of the transaction, TMF locks all records referred to by
the transaction, preventing concurrent access by other transactions. If all statements
in the transaction are executed and the END-TRANSACTION statement is
encountered, TMF commits the requested changes, making them permanent in the
database. TMF then releases the record locks. The steps in this operation are shown
in Figure 7-4. Now, the database is modified in a complete and consistent way, and
the transaction is said to have succeeded. At this point, the transaction is no longer
subject to backout.