You are on page 1of 4

CICS DB2

The CICS DB2 attachment facility provides CICS applications with access to DB2 data while operating in the CICS environment. The connection between CICS and DB2 can be created or terminated at any time, and CICS and DB2 can be started and stopped independently. 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: o STRT : Start the connection o STOP : Stop the connection o DISP : display the status of threads and display statistic o MODI : modify the characteristic of the connection to DB2 o DISC : disconnect thread When an application program operating in the CICS environment issues its first SQL request, CICS and DB2 process the request as follows: o A language interface, or stub, DSNCLI, that is link-edited with the application program calls the CICS resource manager interface (RMI). o The RMI processes the request, and passes control to the CICS DB2 attachment facilitys task-related user exit (TRUE), the module that invokes DB2 for each task. o The CICS DB2 attachment facility schedules a thread for the transaction. At this stage, DB2 checks authorization, and locates the correct application plan. o DB2 takes control, and the CICS DB2 attachment facility waits while DB2 services the request. o When the SQL request completes, DB2 passes the requested data back to the CICS DB2 attachment facility. o CICS now regains control, and the CICS DB2 attachment facility passes the data and returns control to the CICS application program. Three types of threads : o Command Thread : For establishing connection between DB2 and CICS . Defined in DB2CONN definition. o Entry Thread : Special types of thread for specific purpose , defined in DB2ENTRY definition . o Pool Thread : Used for all transactions and commands that are not using an entry thread or a DB2 command thread, for low volume transaction , defined in DB2CONN definition. Three definitions : o DB2CONN : need to install DB2CONN before you can start CICS DB2 connection . Define the attribute of COMMAND thread , CICS DB2 connection and Pool thread, only one DB2CONN definition installed in a CICS system. o DB2ENTRY : can have many DB2ENTRY definitions , to gain priority access to DB2 resources , define the attribute of ENTRY thread

DB2TRAN : to associate additional transactions with a particular DB2ENTRY , specify the name of DB2ENTRY , specify a transaction

Connection between DB2 and CICS defined in RCT table. DB2CONN = YES in SIT table for automatic connection. Manual Connection : o DSCN STRT command o CEMT SET DB2CONN CONNECTED o EXEC CICS SET DB2CONN CONNECTED Stopping the attachment facility : Automatic : SHUTDOWN option Manual : o DSCN STOP command o CEMT SET DB2CONN DISCONNECTED o EXEC CICS SET DB2CONN NOTCONNECTED The CICS DB2 attachment facility DSNC command allows you to enter DB2 commands from CICS . DSCN command : o DSCN DISP THREAD(name) DSCN DISCONNECT disconnects threads o DSCN DISC plan name Protected Thread : defined within the DB2ENTRY parameter , used for high volume transaction of any type , terminal & non terminal oriented transactions with many commits . Unprotected Thread : defined within the DB2ENTRY parameter , used for fast response time but with a low volume , limited concurrency transactions. Select the correct type of thread for optimum performance. Transaction using protected thread should use a plan bound with ACQUIRE(ALLOCATE) and RELEASE( DEALLOCATE) to reduce the amount of work done. RELEASE(DEALLOCATE) optimizes performance if there are many commit in the program. Protected entry for allocate and de allocate. Unprotected entry for use and commit. Bind Options o When binding multiple programs into an application plan, be aware of the way in which DB2 uses time stamps. For each program, the DB2 precompiler: o Creates a DBRM with a time stamp of Tdx (for example Td1 for the first program, Td2 for the second program, and so on). o Creates a modified source program with a time stamp of Tsx in the SQL parameter list (for example Ts1 and Ts2, if two programs are involved). At bind time, the DBRM for each program is bound into the package or plan that you have specified. In addition, DB2 updates its catalog table SYSIBM.SYSDBRM with one line for each DBRM, together with its time stamp. At execution time, DB2 checks the time stamps for each SQL

statement, and returns a -818 SQL code if the time stamp for the DBRM and the time stamp it has placed in the source program are different (in our example, if Td1 and Ts1 are different, or Td2 and Ts2 are different). To avoid -818 SQL codes, use one of the following strategies : o Bind all programs into packages, and list these packages in the application plan. When a program changes, simply precompile, compile, and link-edit the program, and bind it into a package again. o If you bind any programs directly into application plans, ensure that for every new or changed program, you precompile, compile, and link-edit the program, then bind all the application plans that involve that program, using the DBRMs from all the programs directly bound into those plans. Use the BIND command, not the REBIND command, to do this. When you bind a plan, a number of options are available. Almost all bind options are application dependent and should be taken into account during the application design. You should develop procedures to handle different BIND options for different plans. Also, the procedures should be able to handle changes in BIND options for the same plan over time. Dump for CICS DB2 Control blocks from the CICS DB2 attachment facility are formatted out in a CICS system dump under the control of the DB2 keyword of the CICS IPCS verbexit. The DB2 keyword may specify the following values: o o o o 0 1 2 3 no DB2 output summary information only control blocks only summary and control blocks

In a CICS transaction dump, no summary or control blocks appear but the trace table contains the CICS DB2 trace entries. DB2 Thread Identification A thread executing in DB2 on behalf of a CICS transaction is identified by its correlation ID set by the CICS DB2 Attachment Facility. DB2 allows up to 12 bytes to be used for the correlation ID. eeeettttnnnn : eeee is COMD , POOL , ENTR tttt : transaction id and nnnn : unique number Deadlock Detection the easiest way to get information about a deadlock is to scan the MVS log to find the messages

You might also like