The MAXOPENTCBS system initialization parameter and TCBLIMIT

As well as the DB2CONN, DB2ENTRY, and DB2TRAN objects you define, the CICS® DB2® connection is affected by a system initialization parameter, MAXOPENTCBS. MAXOPENTCBS controls the total number of L8 and L9 mode open TCBs that the CICS region can have in operation at any time.

MAXOPENTCBS is relevant when CICS is connected to DB2 because CICS uses L8 and L9 mode open TCBs to run threads into DB2. L8 and L9 mode open TCBs are reserved for use by task-related user exits that are enabled with the OPENAPI option. These include the CICS DB2 task-related user exit.

In the open transaction environment, the TCBLIMIT attribute of the DB2CONN definition controls how many of the L8 and L9 mode open TCBs can be used by the CICS DB2 task-related user exit to run threads into DB2. If the TCBLIMIT is reached, the CICS DB2 task-related user exit can obtain a TCB from the pool controlled by MAXOPENTCBS, but it must wait before it can use the TCB to run a thread into DB2. When another task stops using its L8 or L9 mode TCB to run a thread into DB2, and so the number of TCBs in use running threads falls below TCBLIMIT, the waiting task is allowed to use its own L8 or L9 mode TCB to run a thread into DB2. However, if MAXOPENTCBS is reached, no more L8 and L9 mode open TCBs are allowed in the CICS region, and the CICS DB2 task-related user exit cannot even obtain an L8 or L9 mode TCB for its use. It must wait until an L8 mode TCB or an L9 mode TCB (used by OPENAPI programs) is released by another task and returned to the pool controlled by MAXOPENTCBS. If an L8 TCB is released, the task can use this TCB, if it was an L9 TCB that was released then CICS "steals" the TCB, meaning it detaches the L9 TCB and attaches an L8 TCB in its place for the task to use.

To ensure that you have enough L8 and L9 mode open TCBs available to meet your DB2 workload, set the limit in your MAXOPENTCBS system initialization parameter to a value greater than the limit set in the TCBLIMIT attribute of your DB2CONN definition. If MAXOPENTCBS is lower than TCBLIMIT, the system can run out of L8 and L9 mode open TCBs before it reaches TCBLIMIT. When CICS connects to DB2, a warning message, DFHDB2211, is issued if the CICS DB2 attachment facility detects that the setting of MAXOPENTCBS in the SIT is lower than the TCBLIMIT setting in the DB2CONN definition. If you receive this warning message, adjust your MAXOPENTCBS limit.

In addition, when running with Transaction Isolation active, set MAXOPENTCBS to the value of max tasks (MXT) or higher. This setting minimizes the possibility of TCB stealing due to a TCB being allocated to the wrong subspace.