COBOL Manual for TNS/E Programs (H06.03+)

Fault-Tolerant Processes
HP COBOL Manual for TNS/E Programs520347-003
32-16
Concepts
Multiple Changes to a Single File
Suppose that the corporate personnel system does not use multiple files, but a single
file. If you want to move an employee’s record from one department’s portion of the file
to another department’s portion of the file, the same problem arises as that with
multiple files. If the record is deleted from one place in the file and written to another
place in the file, there is an interval during which the database is inconsistent.
Defining Transactions
Because you, as the application programmer, are in the best position to define what
constitutes a transaction, TMF gives you the authority to specify the beginning and the
end of the transaction.
In a Pathway application, the SCREEN COBOL terminal program uses the BEGIN-
TRANSACTION and END-TRANSACTION statements for this purpose.
In pTAL and HP COBOL programs outside of the Pathway environment, you must call
the operating system routines BEGINTRANSACTION and ENDTRANSACTION
explicitly.
If a terminal program determines that a transaction cannot or must not complete, it
uses the SCREEN COBOL ABORT-TRANSACTION statement to instruct TMF to back
it out and not retry it. If a process written in pTAL or HP COBOL needs to abort a
transaction, it calls the ABORTTRANSACTION routine.
If a terminal program determines that a transaction should be aborted and retried as a
new transaction (because of a locking contention problem, for example), it can use the
SCREEN COBOL RESTART-TRANSACTION statement to initiate the operation. The
pTAL or HP COBOL process must explicitly use the ABORTTRANSACTION routine
and handle its own restarting.
After TMF is informed of the boundaries of a transaction, it can assure that either the
entire transaction is performed or none of it is performed. TMF does this by using audit
trails.
Audit Trails
An audit trail is a set of disk files in which a record is kept of before-images and after-
images of all records changed by each transaction that occurs in a certain file. A file is
described as audited when it has an audit trail. In TMF, every disk file in which records
are to be changed can be audited. If a disk is involved in transactions whose failure
could leave the database in an inconsistent state, that disk file should be audited.
On NonStop systems, under DP2 (Disk Process 2), all disks permit TMF auditing. To
instruct TMF to audit a file, use the attribute AUDITED, which you set with the FUP
command SET or ALTER. The AUDITED attribute is an attribute of the disk file itself;
an HP COBOL program is unaware of and cannot affect this attribute.