A CICS® DB2® attachment facility is provided with CICS. The CICS DB2 attachment facility provides CICS applications with access to DB2 data while operating in the CICS environment. CICS applications, therefore, can access both DB2 data and CICS data. CICS coordinates recovery of both DB2 and CICS data if transaction or system failure occurs.
The CICS DB2 attachment facility creates an overall connection between CICS and DB2. CICS applications use this connection to issue commands and requests to DB2. The connection between CICS and DB2 can be created or terminated at any time, and CICS and DB2 can be started and stopped independently. You can name an individual DB2 subsystem to which CICS connects, or (if you have DB2 Version 7 or later) you can use the group attach facility to let DB2 choose any active member of a data-sharing group of DB2 subsystems for the connection. You also have the option of CICS automatically connecting and reconnecting to DB2. A DB2 system can be shared by several CICS systems, but each CICS system can be connected to only one DB2 subsystem at a time.
Attachment commands display and control the status of the CICS DB2 attachment facility, and are issued using the CICS supplied transaction DSNC. The attachment commands are:
The connection between CICS and DB2 is a multithread connection. Within the overall connection between CICS and DB2, there is a thread--an individual connection into DB2--for each active CICS transaction accessing DB2. Threads allow each CICS transaction to access DB2 resources, such as a command processor or an application plan (the information that tells DB2 what the application program's SQL requests are, and the most efficient way to service them). See Overview: How threads work below for a full explanation of how threads work.
When an application program operating in the CICS environment issues its first SQL request, CICS and DB2 process the request as follows:
DB2 requires several different address spaces. Figure 1 shows these address spaces.
Various tasks are performed in the different address spaces, as follows: