Maintaining data integrity

Design your application to cope with the things that can go wrong while a transaction is running, for example, a session failing. The conversation protocol helps you recover from errors and ensures that the two sides remain in step with each other. This use of the protocol is called synchronization.

Synchronization allows you to protect recoverable resources such as transient data queues and files, whether they are local or remote. Whatever goes wrong during the running of a transaction should not leave the associated resources in an inconsistent state.

An application program can cancel all changes made to recoverable resources since the last known consistent state. This process is called rollback. The physical process of recovering resources is called backout. The condition that exists as long as there is no loss of consistency between distributed resources is called data integrity.

Sometimes you might need to backout changes to resources, even though no error conditions have arisen. Consider an order entry system. While entering an order for a customer, an operator is told by the system that the customer’s credit limit would be exceeded if the order went through. Because there is no use continuing until the customer is consulted, the operator presses a function key to abandon the order. The transaction is programmed to respond by returning the data resources to the state they were in at the start of the order transaction.

The point in a process where resources are declared to be in a known consistent state is called a synchronization point, often shortened to sync point. Sync points are implied at the beginning and end of a transaction. A transaction can define other sync points by program command. All processing between two sync points belongs to a unit of work (UOW). In a distributed process, this is also known as a distributed unit of work.

When a transaction issues a sync point command, CICS® commits all changes to recoverable resources associated with that transaction. After the sync point, the transaction can no longer back out changes made since the previous sync point. They have become irreversible.

Although CICS can commit and backout changes to local and remote resources for you, this service must be paid for in performance. If the recovery of resources throughout a distributed process is not a problem (for example, in an inquiry-only application), you can use simpler methods of synchronization.