• Retain CONCURRENCY=QUASIRENT on the program definition. Programs defined as QUASIRENT will always be dispatched on the QR TCB. The QR runs only one task at a time, so any storage access the program makes is automatically serialized. The advantage of this method of serialization is that it doesn’t require any program or CICS System Definition (CSD) modification. The disadvantages are that programs forced to run on the QR TCB don’t produce any CPU savings when using DB2; all programs that access the shared storage in question must remain as QUASIRENT; and the future risk that a programmer added access to these areas to a program defined as CONCURRENCY=THREADSAFE.
  • Move the data to a facility serialized by CICS or DB2. A DB2 table, or a CICS resource such as temporary storage or transient data, provides serialization. The advantages include use of an IBM-supported resource; use of a facility that programmers are familiar with; and compliance with internal coding standards. The disadvantages include the additional overhead associated with the facility and the potential use of non-threadsafe commands.
  • Use serializing CICS commands. EXEC CICS ENQ and DEQ provide the capability to serialize access to application resources. The advantages include use of the standard CICS Application Program Interface (API) and the ability to serialize only the specific lines of code required. The disadvantages include the additional overhead (which is minor) and the potential for deadly embraces. Note that prior to CICS TS 4.1, the EXEC CICS ENQ operates in a separate pool from the XPI ENQ. The CICS ENQ facility can’t be used to serialize access between an XPI user and an API user prior to CICS TS 4.1. The likelihood of requiring serialization between exit points and application programs is small, but attempting to use CICS resources in such a case can cause unpredictable results.
  • Use serializing Assembler commands. Assembler commands such as compare and swap can be used to provide serialized storage access. The advantage is that serialization can be achieved with minimal overhead. The disadvantages are that these commands are limited in capability, are complex to code, and can cause serious problems if coded incorrectly.

As an example, a program that used a CWA field as a record counter could: 

  • Leave the program accessing the CWA as CONCURRENCY=QUASIRENT
  • Move the counter to a DB2 table
  • “Wrap” the counter access in an EXEC CICS ENQ/DEQ
  • Call a special-purpose Assembler subroutine to handle the counter with a compare and swap.

Regardless of which method or methods are used to serialize access, it’s critical that all programs that access the storage be modified before any of them are marked as threadsafe. Adding an ENQ in PROGA to serialize access to the CWA won’t prevent PROGB from updating simultaneously.

Maximizing CPU Savings and Performance

Because the CPU savings achieved in threadsafe CICS/DB2 programs is the result of not issuing TCB swaps, your CPU savings is maximized if your program remains on its L8 TCB from the time it issues its first DB2 command to the time it terminates. This isn’t always possible due to the issue of non-threadsafe commands. (Not all EXEC CICS commands are threadsafe. Consult the Application  Systems Programming Guide for a list of commands that are threadsafe in your release.)

If your program issues a non-threadsafe command while running on the L8 TCB, CICS will automatically swap your task to the QR TCB, where it will remain until the next DB2 command, reducing the potential CPU savings. The reduction in TCB swaps may also result in improved performance.

CPU Savings

In the article, ”CICS Open Transaction Environment And Other TCB Performance Considerations” (, Steven R. Hackenberg, an IBM Certified IT Specialist, gave this example of the potential CPU savings: “To put this in perspective, consider a CICS region that processes 1,000 transactions per second with each doing one DB2 request. That amounts to 4 MIPS just for task TCB switches.”

Another example can be found in the article, “Running OMEGAMON XE for CICS as Threadsafe to Reduce Overhead While Monitoring CICS Transaction Server V2 from CCR2

( written by Richard Burford, an IBM R&D developer. The CPU savings can also have a direct impact on reducing your mainframe software cost.

Improved Performance

4 Pages