The LOCKED relation

When you define an affinity relation of LOCKED to a transaction group, all instances of transactions in the group that are associated with dynamically-linked programs that have the same unit of work must run in the same target region for the lifetime of the unit of work.

The LOCKED relation is associated with a unit of work (UOW). The affinity lifetime for the LOCKED relation is always UOW . The unit of work ends either when a CICS® SYNCPOINT or ROLLBACK request is run, or when the originating task terminates. UOW is valid only for LOCKED affinities between dynamic program link requests.

A typical example of transactions that have a LOCKED relation is where multiple invocations of the same dynamically-routed program access a common resource. Each invocation of the program has a transaction code under which the called program runs on a target system. By specifying that transaction code as part of a transaction group that designates a LOCKED affinity, all instances of dynamic program links for that program name cause the associated remote transaction to be rerouted to the same target region until the caller's unit of work ends. If those subsequent program links were routed to different regions, deadlocks could occur. Therefore work must not be routed away from the region that locked the resource. For further information, see Multiple links to the same server region.

Figure 1 shows an example of an affinity with the LOCKED relation.
Figure 1. Managing inter-transaction affinity with LOCKED relation and UOW lifetime
An example of a transaction with an activity LOCKED relation, routed as described in the following text.

In this example, transaction TRA1 calls program PROGA as part of a unit of work identified by the NETUOWID attribute of the WLMATAFF resource table. PROGA makes an EXEC CICS LINK request to program PROGB on a remote system. PROGB is defined as dynamic and its associated transaction, defined by the TRANSID attribute in the program definition, is EUMI. EUMI is a user-defined mirror transaction belonging to a transaction group that is defined with an affinity relation of LOCKED and an affinity lifetime of UOW. Workload management routes this transaction to CICS region AOR4. The dynamic routing program, after checking whether an affinity already exists, starts a new affinity for EUMI. All subsequent instances of EUMI share this affinity for the lifetime of the unit of work, and are routed to AOR4 until the unit of work ends.