CICS abend

AEY9: Db2 connection not available in CICS

An AEY9 abend means a CICS program issued an SQL request while the CICS Db2 attachment facility wasn't available to pass it to Db2. Either the attachment was never started, it was stopped, or Db2 is down and the connection is set to abend instead of returning SQLCODE -923.

Also written as AEY9 abend, CICS AEY9, abend AEY9, AEY9 DB2, AEY9 CICS DB2 not connected, CICS DB2 attachment AEY9.

What it means

CICS programs reach Db2 through the CICS Db2 attachment facility, which is controlled by the DB2CONN resource in the region. When a program issues EXEC SQL and the attachment can't take the request, the task can end with AEY9.

Whether you get AEY9 or an SQL code depends on the state of the attachment. If it was started but isn't connected to Db2 right now, the DB2CONN attribute CONNECTERROR decides. With CONNECTERROR(ABEND), the program gets AEY9. With CONNECTERROR(SQLCODE), the SQL call returns SQLCODE -923 and the program can handle it. If the attachment was never started, or someone stopped it, the program gets AEY9 whatever CONNECTERROR says.

AEY9 is not a program bug in most cases. The application code usually ran fine yesterday. Something in the connection between CICS and Db2 changed.

Common causes

  • Db2 is down or restarting, or the region lost its connection to it, and the DB2CONN specifies CONNECTERROR(ABEND).
  • The attachment was never started. The region came up without DB2CONN=YES in its system initialization parameters and nothing else started it.
  • Someone stopped the attachment with DSNC STOP or CEMT SET DB2CONN NOTCONNECTED, often for Db2 maintenance, while transactions were still arriving.
  • No DB2CONN is installed in this region at all. This happens with a new region, or when a transaction is routed to a region that was never set up for Db2.

How to find the problem

  1. Run CEMT INQUIRE DB2CONN. It shows whether the attachment is connected and what CONNECTERROR and STANDBYMODE are set to.
  2. Look in the CICS region's log for DFHDB2 messages about the attachment starting, stopping, or losing Db2 around the time of the abends.
  3. Ask the Db2 team, or check the system log, whether the Db2 subsystem was up at that time.
  4. If only some regions get AEY9, compare their DB2CONN definitions and their DB2CONN system initialization parameter. A region that differs from the others is usually the answer.

How to fix it

  • Start the connection with CEMT SET DB2CONN CONNECTED or DSNC STRT once Db2 is available.
  • Set DB2CONN=YES in the region's system initialization parameters so the attachment starts with CICS. Some sites start it from the program list table at startup (PLTPI) instead.
  • Use STANDBYMODE(RECONNECT) on the DB2CONN. The attachment then waits in standby while Db2 is down and reconnects by itself when Db2 comes back.
  • If your programs handle SQLCODE -923 properly, CONNECTERROR(SQLCODE) lets them show a 'database unavailable' message instead of abending.
  • Avoid stopping the attachment while work is still flowing. Stop or drain the Db2 transactions first.
  • AEY9 is fixed by the CICS systems programmers together with the Db2 team. The application team only gets involved when programs need to handle -923.

What it looks like

DFHDU0203I 10/12/2026 06:12:40 CICSPRD3 A transaction dump was taken for dumpcode: AEY9, Dumpid: 1/0102.
DFHAC2206 06:12:40 CICSPRD3 Transaction PAY5 failed with abend AEY9. Updates to local recoverable resources backed out.

Questions

What is the difference between AEY9 and SQLCODE -923?

Both mean CICS couldn't pass the SQL request to Db2. The DB2CONN setting CONNECTERROR decides which one the program sees when the attachment is started but not connected. If the attachment isn't started at all, it's always AEY9.

Should programs check whether Db2 is up before every SQL call?

IBM recommends against it. Issue the SQL and handle -923, with STANDBYMODE(RECONNECT) and CONNECTERROR(SQLCODE) on the DB2CONN. A program that skips the SQL after a check returns fast and looks healthy, so workload management can send that region even more work.