Run CICS + DB2 Transactions Successfully

Running a CICS DB2 transaction means the region is connected to Db2, the transaction can obtain a thread, and the COBOL program's package is reachable through the plan used by that thread. This hands-on guide covers prerequisites, DB2CONN/DB2ENTRY/DB2TRAN setup, run verification, and the errors that appear when attachment and bind drift apart.

Hands-on CICS Db2
Progress0 of 0 lessons

How CICS and DB2 work together

CICS does not replace Db2 packages. The CICS Db2 attachment facility provides threads and authorization mapping so a transaction can issue SQL. The SQL itself still comes from a bound package. Historically, shops configured this interface with an RCT. Modern CICS uses RDO resources instead.

Primary CICS Db2 attachment resources
ResourceRole
DB2CONNDefines the region connection, pool threads, command threads, and TCB limits
DB2ENTRYReserves entry threads and attributes for selected transactions
DB2TRANMaps additional transactions onto an existing DB2ENTRY
PROGRAM / TRANSACTIONOrdinary CICS application definitions that invoke the COBOL/SQL program

You can start a connection with only DB2CONN installed. In that case every Db2 transaction uses pool threads. For prioritized or specialized workloads, add DB2ENTRY definitions and DB2TRAN mappings so important transactions are not waiting behind everything else in the pool.

Prerequisites

CICS Db2 run readiness checks
AreaWhat to verify
ConnectionDB2CONN installed for the region and able to connect to the target Db2 ssid/group.
CICS definitionsPROGRAM, TRANSACTION, and mapset/file resources installed for the application.
Db2 bindPackage bound and plan available to the auth ID/plan name used by the thread.
ThreadingTHREADLIMIT and TCBLIMIT sized for expected concurrency; entry threads defined if needed.
SecurityCICS user and Db2 authorization model agreed for plan execute and table access.

Confirm whether the region starts the Db2 connection automatically during initialization or whether operators start it explicitly. Also confirm the plan name strategy used on DB2CONN and DB2ENTRY definitions, because that plan is what must include your package collection.

Steps: run CICS + Db2

1. Install and start DB2CONN

Define DB2CONN with the target Db2 subsystem or group attach name, pool THREADLIMIT, COMTHREADLIMIT, and TCBLIMIT. TCBLIMIT should be large enough for the sum of entry thread limits, pool threads, and command threads you expect to use. Install the resource and start the connection according to site procedure.

text
1
2
3
4
5
6
7
8
* Conceptual CEDA-style attributes (names vary by site) DB2CONN: DB2ID = DB2T CONNECTERROR = SQLCODE THREADLIMIT = 20 /* pool threads */ COMTHREADLIMIT = 1 TCBLIMIT = 40 PLAN = TRAINPLN /* if using a fixed plan name model */

2. Add DB2ENTRY / DB2TRAN for priority work

Create a DB2ENTRY for a critical transaction or transaction group. Set THREADLIMIT, PROTECTNUM if protected threads are desired, ACCOUNTREC, AUTHID/AUTHTYPE, PLAN or PLANEXITNAME, and THREADWAIT behavior. Use DB2TRAN when additional transaction IDs should share that entry.

text
1
2
3
4
5
6
7
8
9
10
DB2ENTRY: TRANSID = EMP1 THREADLIMIT = 4 PROTECTNUM = 1 THREADWAIT = POOL PLAN = TRAINPLN DB2TRAN: TRANSID = EMP2 ENTRY =

3. Deploy the CICS program and Db2 package together

Promote the CICS load module and the matching Db2 package as one unit. A CICS NEWCOPY of a rebound COBOL program without the matching package is a common source of SQLCODE -818. Bind into the collection listed by the plan used on the connection or entry.

4. Run the transaction and watch threads

Clear a terminal, enter the transaction ID, and exercise the SQL path. Under test load, issue DSNC DISPLAY STATISTICS and review pool versus entry usage, waits, and aborts. Increase limits only with an understanding of Db2 CTHREAD capacity and region TCB budget.

Verify results

  • Confirm the CICS Db2 connection is up for the region.
  • Run the transaction and verify screen output plus expected table changes.
  • Check CICS messages and Db2 accounting/thread statistics for unexpected waits.
  • Query SYSIBM.SYSPACKAGE and the plan package list for the collection used in this region.
  • Validate syncpoint behavior: a forced failure mid-update should not leave committed partial work unless the design intentionally uses multiple units of work.
text
1
2
3
4
5
6
7
CEMT I DB2CONN DSNC DISPLAY STATISTICS -- Then verify business data with SPUFI or a query tool SELECT EMP_ID, EMP_NAME, DEPT_CODE FROM TRAINING.EMPLOYEE WHERE EMP_ID = 1001;

Common errors

Frequent CICS Db2 run problems
SymptomLikely causeCorrective action
Transaction fails because Db2 is not connectedDB2CONN not installed/started, or Db2 subsystem unavailableStart/check the CICS Db2 connection and Db2 status, then retry.
Waits or AEY9-style thread problems under loadTHREADLIMIT/TCBLIMIT too low or THREADWAIT behavior too strictReview DSNC statistics and adjust entry/pool/TCB limits with capacity planning.
SQLCODE -805 in CICSPlan/package not found for the thread plan name or collectionVerify the plan used by DB2CONN/DB2ENTRY and the package PKLIST contents.
SQLCODE -818 in CICSNew program load in CICS without matching package bindNEWCOPY/PHASEIN only after the matching package is bound and promoted.
Authorization failure at first SQLAuth ID from AUTHID/AUTHTYPE settings lacks plan or table privilegesConfirm the authorization model on DB2CONN/DB2ENTRY and grant the minimum required.

Thread wait symptoms can also come from Db2-side local thread limits being too small for all CICS regions attached to the subsystem. Coordinate CICS THREADLIMIT totals with Db2 capacity and with other local attachments such as batch and TSO.

Explain It Like I'm Five

CICS is a busy restaurant dining room. Db2 is the kitchen. DB2CONN is the hallway that connects them. Pool threads are shared waiters. DB2ENTRY is a set of reserved waiters for VIP tables. The package is the recipe card the kitchen already prepared. If the hallway is closed, or the recipe card is missing, the dining room can be full of customers and still serve no Db2 meals.

Exercises

  1. List the difference between running with only DB2CONN and adding a DB2ENTRY for transaction PAY1.
  2. Explain why TCBLIMIT should not be smaller than the threads you expect to use.
  3. Write a promotion checklist that keeps CICS NEWCOPY and Db2 BIND PACKAGE in sync.
  4. Given long wait-for-thread times, identify three places to look before raising every limit.
  5. Describe who should issue the syncpoint in a CICS Db2 update transaction and why.

Quiz

Test Your Knowledge

1. Which CICS resource must be installed before the CICS Db2 connection can start?

  • Only a TDQUEUE
  • DB2CONN
  • Only an FCT entry
  • Only SPUFI

2. What is the modern replacement for the old RCT macro approach?

  • Hard-coded STEPLIB only
  • RDO resources DB2CONN, DB2ENTRY, and DB2TRAN
  • Only BIND PACKAGE
  • Only DSNTIAUL

3. Why define a DB2ENTRY for an important transaction?

  • It deletes the need for a plan
  • It can reserve specialized or protected threads so critical work is not always competing only in the general pool
  • It replaces BIND
  • It disables SQLCODE checking

4. Where does a CICS COBOL Db2 program still get its SQL access paths?

  • Only from the CICS SIT
  • From the Db2 package/plan environment, just as in batch
  • Only from temporary storage
  • Only from CECI

5. Which command helps inspect CICS Db2 thread use?

  • DSNC DISPLAY STATISTICS
  • REORG TABLESPACE
  • COPY TABLESPACE
  • LISTCAT ENT

Frequently Asked Questions