Avoiding AEY9 abends
An AEY9 abend occurs if an application issues an EXEC SQL command when the CICS® Db2® attachment facility has not been enabled.
About this task
EXEC CICS EXTRACT EXIT PROGRAM('DFHD2EX1')
ENTRY('DSNCSQL')
GASET(name1)
GALENGTH(name2)
If you specify a program name of DSNCEXT1 or DSN2EXT1 CICS
dynamically changes it to the required name DFHD2EX1. If you get the INVEXITREQ condition, the CICS
Db2 attachment facility is
not enabled. When the CICS Db2 attachment facility is enabled, it is not necessarily connected to Db2. It can be waiting for Db2 to initialize. When this occurs, and an application issues an EXEC SQL command when CONNECTERROR=ABEND is specified in the DB2CONN, an AEY9 abend would result. CONNECTERROR=SQLCODE would result in a -923 SQL code being returned to the application.
You can use the INQUIRE EXITPROGRAM command with the CONNECTST keyword in place of the EXTRACT EXIT command to determine whether the CICS is connected to Db2.
- CONNECTED, when the CICS Db2 attachment facility is ready to accept SQL requests
- NOTCONNECTED, when the CICS Db2 attachment facility is not ready to accept SQL requests
If the command fails with PGMIDERR, this is the same as NOTCONNECTED.
CSTAT DS F
ENTNAME DS CL8
EXITPROG DS CL8
...
MVC ENTNAME,=CL8'DSNCSQL'
MVC EXITPROG,=CL8'DFHD2EX1'
EXEC CICS INQUIRE EXITPROGRAM(EXITPROG) X
ENTRYNAME(ENTNAME) CONNECTST(CSTAT) NOHANDLE
CLC EIBRESP,DFHRESP(NORMAL)
BNE NOTREADY
CLC CSTAT,DFHVALUE(CONNECTED)
BNE NOTREADY
If you specify a program name of DSN2EXT1, CICS dynamically changes it to the required name, DFHD2EX1.
Further consideration on the use of the EXTRACT EXIT or INQUIRE EXITPROGRAM commands by applications has to be made when running in an environment where dynamic workload balancing using the z/OS® Workload Manager (WLM) is taking place.
- Specify STANDBYMODE=RECONNECT in the DB2CONN. This ensures that the CICS Db2 attachment facility waits (in standby mode) for DB2® to initialize and connect automatically, should Db2 be down when connection is first attempted. Also, if Db2 subsequently fails, the CICS Db2 attachment facility reverts again to standby mode and wait for Db2. It then automatically connects when Db2 returns.
- Use CONNECTERROR=SQLCODE provided applications handle the -923 code correctly.
- Avoid using EXTRACT EXIT or INQUIRE EXITPROGRAM commands if CONNECTERROR=SQLCODE can be used.
- Use CONNECTERROR=ABEND if an AEY9 abend is required. Use the INQUIRE EXITPROGRAM command instead of the EXTRACT EXIT command.
- It is worth noting that AEY9 abends can still occur even when STANDBYMODE=RECONNECT and
CONNECTERROR=SQLCODE are specified if:
- The CICS Db2 attachment facility is never started. An AEY9 results if an application issues an EXEC SQL command. You should always specify DB2CONN=YES in the SIT, or program DFHD2CM0 in PLTPI. Therefore the CICS Db2 attachment is at minimum in standby mode.
- The CICS Db2 attachment is shut down using a DSNC STOP or CEMT/EXEC CICS SET DB2CONN NOTCONNECTED command.