Designing to avoid transaction deadlocks
You must design your program to avoid transaction deadlocks. There are a number of techniques that you can use in your program to avoid this situation.
About this task
Consider using the following techniques:
Procedure
- Arrange for all transactions to access files in a sequence agreed in advance. This could be a suitable subject for installation standards. Be extra careful if you allow updates through multiple paths.
- Enforce explicit installation enqueueing standards so that all
applications do the following:
- Enqueue by the same character string
- Use those strings in the same sequence.
- Always access records within a file in the same sequence. For example, where you update several file or database records,
ensure
that you access them in ascending sequence.
Ways of doing this include the following:
- The terminal operator always enters data in the existing data
set sequence.
This method requires special terminal operator action, which may not be practical within the constraints of the application. (For example, orders may be taken by telephone in random product number sequence.)
- The application program first sorts the input transaction
contents so
that the sequence of data items matches the sequence on the data
set.
This method requires additional application programming, but imposes no external constraints on the terminal operator or the application.
- The application program issues a SYNCPOINT command after
processing each
data item entered in the transaction.
This method requires less additional programming than the second method. However, issuing a synchronization point implies that previously processed data items in the transaction are not to be backed out if a system or transaction failure occurs before the entire transaction ends. This may not be valid for the application, and raises the question as to which data items in the transaction were processed and which were backed out by CICS® . If the entire transaction must be backed out, synchronization points should not be issued, or only one data item should be entered per transaction.
Of the three methods, the second (sorting data items into an ascending sequence by programming) is most widely accepted.
If you allow updates on a data set through the base and one or more alternate index paths, or through multiple alternate index paths, sequencing record updates may not provide protection against transaction deadlock. You are not protected because the different base key sequences will probably not all be in ascending (or descending) order. If you do allow updates through multiple paths, and if you need to perform several record updates, always use a single path or the base. Define such a procedure in your installation standards.
- The terminal operator always enters data in the existing data
set sequence.
dfht236.html |
Last updated: Monday, 5 June 2017