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.
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.
| Resource | Role |
|---|---|
| DB2CONN | Defines the region connection, pool threads, command threads, and TCB limits |
| DB2ENTRY | Reserves entry threads and attributes for selected transactions |
| DB2TRAN | Maps additional transactions onto an existing DB2ENTRY |
| PROGRAM / TRANSACTION | Ordinary 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.
| Area | What to verify |
|---|---|
| Connection | DB2CONN installed for the region and able to connect to the target Db2 ssid/group. |
| CICS definitions | PROGRAM, TRANSACTION, and mapset/file resources installed for the application. |
| Db2 bind | Package bound and plan available to the auth ID/plan name used by the thread. |
| Threading | THREADLIMIT and TCBLIMIT sized for expected concurrency; entry threads defined if needed. |
| Security | CICS 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.
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.
12345678* 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 */
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.
12345678910DB2ENTRY: TRANSID = EMP1 THREADLIMIT = 4 PROTECTNUM = 1 THREADWAIT = POOL PLAN = TRAINPLN DB2TRAN: TRANSID = EMP2 ENTRY =
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.
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.
1234567CEMT 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;
| Symptom | Likely cause | Corrective action |
|---|---|---|
| Transaction fails because Db2 is not connected | DB2CONN not installed/started, or Db2 subsystem unavailable | Start/check the CICS Db2 connection and Db2 status, then retry. |
| Waits or AEY9-style thread problems under load | THREADLIMIT/TCBLIMIT too low or THREADWAIT behavior too strict | Review DSNC statistics and adjust entry/pool/TCB limits with capacity planning. |
| SQLCODE -805 in CICS | Plan/package not found for the thread plan name or collection | Verify the plan used by DB2CONN/DB2ENTRY and the package PKLIST contents. |
| SQLCODE -818 in CICS | New program load in CICS without matching package bind | NEWCOPY/PHASEIN only after the matching package is bound and promoted. |
| Authorization failure at first SQL | Auth ID from AUTHID/AUTHTYPE settings lacks plan or table privileges | Confirm 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.
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.
1. Which CICS resource must be installed before the CICS Db2 connection can start?
2. What is the modern replacement for the old RCT macro approach?
3. Why define a DB2ENTRY for an important transaction?
4. Where does a CICS COBOL Db2 program still get its SQL access paths?
5. Which command helps inspect CICS Db2 thread use?