I.T.TRAININGS
Overview of CICS and DB2 Interface Course designed and Conducted by Sunderrajan Iyer
[email protected] Jul 17, 2009
Overview of CICS and DB2 Interface
1
CICS attachment facility
I.T.TRAININGS
• A CICS attachment facility is provided with CICS that allows you to operate DB2 with CICS. – 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 also have the option of CICS automatically connecting and reconnecting to DB2. – The DB2 system can be shared by several CICS systems • But each CICS system can be connected to only one DB2 subsystem at any one time.
Jul 17, 2009
Overview of CICS and DB2 Interface
2
I.T.TRAININGS
Attachment Commands • Attachment commands display and control the status of the attachment facility and are issued using the supplied CICS transaction DSNC. DSNC • The attachment commands are: – – – – –
STRT - start the connection to DB2 STOP - stop the connection to DB2 DISP - display the status of the connection to DB2 MODI - modify characteristics of the connection to DB2 DISC - disconnect threads
Jul 17, 2009
Overview of CICS and DB2 Interface
3
More on Attachment Facility
I.T.TRAININGS
• The CICS DB2 attachment facility provides a multithread connection to DB2 – There is a thread for each active CICS transaction accessing DB2 – Threads allow each CICS application transaction and DB2 command to access DB2 resources • Application Plan
– Each thread, used by a CICS transaction, or by a command, runs under its own subtask task control block (TCB). – A thread is defined based on the specifications in RDO when a transaction issues the first SQL statement – If a existing thread is available, it is used before creating a new thread
Jul 17, 2009
Overview of CICS and DB2 Interface
4
Types of Threads • Command Threads – These are reserved to be used by the DSNC transaction
I.T.TRAININGS
• Entry Threads – They are intended to be used by transactions • If defined as protected, they are not terminated when no CICS transaction is using them • If defined as unprotected, they are terminated if no CICS transaction is using them
• Pool Threads – They are used for all transactions not using Entry or Command thread – They are intended for low volume transactions, and as a overflow from command and entry threads
Jul 17, 2009
Overview of CICS and DB2 Interface
5
How CICS interacts with DB2
I.T.TRAININGS
• The CICS DB2 attachment facility provides CICS applications to access DB2 database while operating in the CICS environment – The application can access both CICS and DB2 data at the same time
• CICS co-ordinates recovery of both DB2 and CICS data when a failure occurs
Jul 17, 2009
Overview of CICS and DB2 Interface
6
I.T.TRAININGS
How CICS interacts with DB2
Jul 17, 2009
Overview of CICS and DB2 Interface
7
I.T.TRAININGS
Address Spaces in DB2 • • • • •
DSN1MSTR: System Service Component DSN1DBM1: Database Service Component DSN1DIST : Distributed Service Component IRLMPROC : Resource Lock Manager DSN1SPAC: For DB2 stored procedures
Jul 17, 2009
Overview of CICS and DB2 Interface
8
I.T.TRAININGS
How a CICS Task works with DB2 • When an application program issues its first SQL request the CICS resource manager interface (RMI) processes the request and passes control to the attachment facility's task related user exit (TRUE). • A transaction thread is scheduled by the CICS attachment facility, and at this stage DB2 checks authorization, creates control blocks and allocates the application plan. • When the SQL request completes DB2 passes data back to the CICS attachment facility, and the CICS task regains control until the CICS transaction issues another SQL request. • Finally, the CICS attachment facility returns control to the CICS application program. Jul 17, 2009
Overview of CICS and DB2 Interface
9
I.T.TRAININGS
How a CICS Task works with DB2
Jul 17, 2009
Overview of CICS and DB2 Interface
10
I.T.TRAININGS
Resource Control Table • In releases of CICS prior to Transaction Server for OS/390 V1 R2, the connection between CICS and DB2 was done using resource control table • The resource control table contains relationship between CICS transactions and the resources it requires – Application Plans
• It is generated using DSNCRCT macro provided by CICS attachment facility
Jul 17, 2009
Overview of CICS and DB2 Interface
11
I.T.TRAININGS
Resource Definition Online • CICS TS R3, no longer supports RCT entries defined using DSNCRCT macro • You have to use Resource Definition Online facility of CICS TS R3 • Using RDO following objects can be created – DB2CONN: Defines the global attributes of the CICS DB2 interface and defines the attributes of pool threads and command threads – DB2ENTRY: Defines entry threads to be used by a specific transaction or group of transactions – DB2TRAN: Defines additional transactions to be associated with a particular DB2ENTRY
Jul 17, 2009
Overview of CICS and DB2 Interface
12
I.T.TRAININGS
Main activities in SQL processing • You should select the thread type to use for a given set of transactions together with the BIND parameters for the corresponding plan. • This is because the BIND parameters determine whether a number of activities are related to the thread or to the transactions. • The main DB2 activities involved in processing CICS transactions with SQL calls are – – – –
Create a thread or reuse an existing thread. Process the SQL statements. Perform commit processing. Terminate the thread or keep it.
Jul 17, 2009
Overview of CICS and DB2 Interface
13
Main activities in SQL processing
I.T.TRAININGS
• These main activities are performed for each transaction. • The most important options are: – DB2CONN and DB2ENTRY specifications • Use of protected entry threads • Use of unprotected entry or pool threads • Authorization strategy
– BIND options • ACQUIRE • RELEASE • VALIDATE
– Use of PACKAGES
Jul 17, 2009
Overview of CICS and DB2 Interface
14