Overview of Transaction Management

Standard COBOL contains a weakness in its handling of file operations in that it does not provide a method of defining transactions. This section describes the special features of ACUCOBOL-GT that allow the security of transaction management.

The benefits of a transaction management system are best illustrated by an example. A COBOL application that handles order entry might perform these steps to accept an order:

  1. Write an invoice record.
  2. Update a customer record.
  3. Write a payroll record for sales commissions.
  4. Update an inventory record.

This series of four file operations is a logical unit. If the program were interrupted, and completed only some of the four file operations, then the files would be in an inconsistent state. For example, if the program died after it updated the customer record, but before it updated the inventory record, then a subsequent run might access non-existent inventory.

The solution to this problem is to provide a method where the programmer can define a set of operations that should either all occur or all not occur. Then, if the program encounters an error or dies, the files are left in a consistent state.

Sites using transaction management should ensure that all users are referring to the same files by the same names. For example, all users should map the same network directory to the same drive letter.