You are on page 1of 41

IBM ^

Introduction to CICS Transaction Server

for OS/390 – Unit 3

© 2004 IBM Corporation


IBM ^

Unit 3: CICS and databases

Topics:

 3A. Types of databases


Relational
Hierarchical
 3B. The CICS-DB2 interface
 3C. Working with databases

© 2004 IBM Corporation


IBM ^

Unit 3 overview

Databases are included as key resources for almost any mainframe


business environment. All businesses use some type of database setup
to store customer information or other types of important data that
needs to be updated and retrieved easily.

Today, large relational databases such as DB2 are used widely.


However, hierarchical applications, used more frequently in the early
days of mainframes, are still popular.

(continued)

© 2004 IBM Corporation


IBM ^

Unit 3 overview

This unit deals with databases


and CICS interactions with them.

Using a financial institution’s


CICSPlex as a model, you will
trace the path of a transaction
from a remote terminal through
CICS to an Information Management
System (IMS) database.

© 2004 IBM Corporation


IBM ^

Unit 3 objectives
Upon completing this unit, this is what you should be able to do:

 Distinguish between a relational and a hierarchical database, and list


the advantages of each

 Explain how CICS supports and interacts with the two largest
database products used: DB2 and IMS
 Describe the functions and advantages of the CICS attachment facility
for DB2

 Describe the typical CICSPlex setup, and how the various products
interact to provide customer services in a modern banking model
 Describe the path of a transaction from a remote terminal to a CICS-
connected database

 Describe the role that CICS plays in a typical bank transaction based
on an IMS model
© 2004 IBM Corporation
IBM ^

3A. CICS-supported databases

The two most common types of


databases are relational and
hierarchical.

CICS supports both types of


databases, primarily through
these IBM applications:

 DB2, developed in the 1980s


 IMS, used since the early 1970s

© 2004 IBM Corporation


IBM ^

3A. CICS-supported databases

The database application that a


business selects depends directly on
business needs.

Although DB2 is widely popular in


mainframe use, some businesses
(financial institutions in particular)
have found it expensive and difficult to
adapt their existing data resources
entirely to DB2. Therefore, IMS is still
widely used in businesses that have
need for a large and accessible
database with well-defined structural
and maintenance requirements.

© 2004 IBM Corporation


IBM ^

3A1. Relational databases

Relational databases are based


on a model developed by an IBM
researcher in 1970.

In a relational database, data is


structured into tables whose
columns specify a particular data
category.

© 2004 IBM Corporation


IBM ^

3A1. Relational databases

DB2 accesses data by referring to its content rather than its location
or organization in storage. In this type of system, data can be accessed
or viewed in many different ways without having to reorganize the
database.

Relational databases are the most common today, because they:


 Are flexible
 Are consistent
 Offer data and application independence

© 2004 IBM Corporation


IBM ^

3A1. Relational databases

The DB2 family (DB2 for ESA, DB2 for VSE, DB2 for VM, DB2 for
OS/390) includes the most common relational database products found
in mainframe environments with CICS TS. CICS provides both
attachment interfaces for DB2 and monitoring and control services.

DB2’s data manager supplies interfaces and utilities that enable


programmers to write data access commands in Structured Query
Language (SQL) with the structure EXEC SQL. This style is very close
to CICS’ EXEC CICS commands. DB2 programs can therefore be
created and modified by programmers with CICS knowledge, and vice
versa.

© 2004 IBM Corporation


IBM ^

3A1. Relational databases

In addition to the CICS EXEC /


EXEC SQL similarity, CICS
applications that can process DB2
tables can also access any SQL
data manager and file control.

That is, CICS applications can use


SQL, and any SQL database
manager can access CICS
applications. This means that DB2
data can be accessed from a
CICS TS for OS/390 environment.

© 2004 IBM Corporation


IBM ^

3A2. Hierarchical databases

Hierarchical databases are based


on a parent-child relationship in
data storage, much as the way a
genealogical diagram traces
backward to an original ancestor.

Their greatest strength is their


speed, especially for large data
banks. However, programmers
who maintain them must be very
familiar with their structure, and
they are much less flexible than
relational databases.

© 2004 IBM Corporation


IBM ^

3A2. Hierarchical databases

Until recently, most of the world’s commercial information was stored on


IMS structures. This means that the continued use of IMS is likely,
considering the high costs and complexity of converting large data
banks to a product like DB2.

Database managers like IMS are particularly effective on CICSPlex


systems where networks take transactions from many terminals or
sources to the appropriate AORs in CICS.

© 2004 IBM Corporation


IBM ^

3A2. Hierarchical databases

The language used for data


manipulation in IMS is Data
Language I (DL/I).

DL/I enables the definition of data


structures and the relation of
structures to applications, and the
loading and reorganization of
these structures. DL/I can enable
application programs to retrieve,
replace, delete and add segments
to databases.

© 2004 IBM Corporation


IBM ^

3A2. Hierarchical databases

There are other important interfaces


that are helpful when using IMS as a
primary database structure.

In many systems, CICS online


programs interface with the IMS
Database Control (DBCTL) facility.

© 2004 IBM Corporation


IBM ^

3A2. Hierarchical databases

IMS Resource Locks Management (IRLM), another interface, helps ensure


efficient updates of a database without loss of data integrity. IRLM’s primary
purpose is to hold locks on segments of the database that IMS/DBCTL is trying
to update, thus ensuring that segments are not accessed until the update is
complete.

Database Recovery Control (DBRC) is an IMS facility containing information


for database recovery. DBRC’s functions are:
Generate recovery control statements
Verify recovery input
Maintain a separate change log for database data sets
Support the sharing of an IMS DL/I database by multiple subsystems (including
IMS or CICS regions)

(continued)

© 2004 IBM Corporation


IBM ^

3A2. Hierarchical databases

Database resource adapter (DRA) is a component of the


CICS/DBCTL interface in the CICS address space. It performs request,
contact and other functions between CICS and DBCTL.

Database-level sharing is an IMS data-sharing type which allows an


application to read data in one region while another application reads or
updates the same data in another region. In this data-sharing type,
CICS can be designated an IMS region.

© 2004 IBM Corporation


IBM ^

3B. Functions of CICS attachment facility

CICS TS for OS/390 comes with an


attachment facility that allows you to
operate DB2 with CICS.

Through this facility, CICS


applications can access DB2 data
while operating within the CICS TS
for OS/390 environment. Thus,
the CICS applications can access
both DB2 and CICS data.

CICS coordinates the recovery of


both DB2 and CICS data if
transaction or system failure occurs.

© 2004 IBM Corporation


IBM ^

3B. Functions of CICS attachment facility

The CICS DB2 attachment facility


provides the following major functions:

 An application program interface


that allows you to operate DB2 with
CICS

 Attachment commands that display


and control the status of the
attachment facility

© 2004 IBM Corporation


IBM ^

3B. Functions of CICS attachment facility


Through the DB2 attachment
facility API, the connection between
CICS and DB2 can be created or
terminated at any time. This
connection and disconnection can
be set up to occur automatically.

You can also start and stop CICS


and DB2 independently.

The DB2 system can be shared by


several CICS systems, but an
individual CICS system can
be connected to only a single DB2
system at a time.

© 2004 IBM Corporation


IBM ^

3B. Using the CICS attachment facility

The attachment commands that come with the CICS DB2 attachment
facility are issued using the CICS-supplied DSNC transaction ID.

The attachment commands include:

 STRT – Start the connection to DB2


 STOP – Stop the connection to DB2
 DISP – Display the status of the connection to DB2
 MODI – Modify the characteristics of the connection to DB2
 DISC – Disconnect threads

© 2004 IBM Corporation


IBM ^

3B. Using the CICS attachment facility

CICS application programs make


requests to DB2 in the form of
Structured Query Language (SQL)
statements.

1) When a CICS application issues


an SQL request, the CICS
resource manager processes the
request and passes control to the
CICS attachment facility.

© 2004 IBM Corporation


IBM ^

3B. Using the CICS attachment facility

2) A transaction thread is scheduled


by the attachment facility.

3) DB2 checks the authorization for


the request and creates control
blocks for it.

4) When the SQL request has been


completed, DB2 passes data back
to the CICS attachment facility, and
the CICS application program
regains control.

© 2004 IBM Corporation


IBM ^

3B. Using the CICS attachment facility

You can use RDO to declare a


particular DB2 database available
to your CICS TS system.

Defining database resources


online means that you do not have
to shut down the CICS-DB2
attachment facility in order to make
changes to CICS-DB2 resources.
This allows continuous availability
for both systems.

© 2004 IBM Corporation


IBM ^

3B. Using the CICS attachment facility

Using RDO to define DB2


resources as CICS-managed
resources also has the advantage
of providing a consistent end-user
interface.

This means that users can use


familiar CICS transaction
identifiers to perform tasks such
as installing and manipulating
database entries.

© 2004 IBM Corporation


IBM ^

3C. Architecture example overview

In order to get a good understanding of the respective roles played by


CICS and a database system, it helps to look at an example of a
transaction processing setup.

In our example, 1st Bank is a midsize financial institution that has two
clusters of OS/390 systems, each with two MVS system images. Within
the MVS images there are multiple CICS and IMS regions. The OS/390
clusters are located in different cites that are miles apart.

© 2004 IBM Corporation


IBM ^

3C. Architecture example overview

© 2004 IBM Corporation


IBM ^

3C. Architecture example overview

CICS receives transactions and communicates with other regions


through Virtual Telecommunications Access Method (VTAM). VTAM is
an IBM API that is used for communicating with telecommunication
devices.

The systems in our example are connected to remote locations and to


each other through a network. Each system also has VTAM connections
in place for each MVS image accessed from the network via network
control program (NCP).

© 2004 IBM Corporation


IBM ^

3C. Architecture example overview

NCPs are key for routing


communication as they manage
the communication traffic between
terminals and CICS.

NCPs also route information between


the VTAM-serviced OS/390 images
and connected CICS regions using
ISC (intersystem communication).

© 2004 IBM Corporation


IBM ^

3C. Transaction initiation

A customer goes to an ATM and


inserts a bankcard. The ATM
requests the PIN number and
other information needed for the
transaction. The customer enters
the information at the PIN pad (1).
The information is routed to the
remote NCP (2), which in turn
takes it through the network to the
mainframe switch and then to the
system NCPs (3), which are tied
to miniprocessors.

© 2004 IBM Corporation


IBM ^

3C. Transaction initiation

The system NCP interfaces with VTAM, which is tied to all applications
on the mainframe. VTAM recognizes the transaction header and routes
it through the security translator application. Every remote terminal,
such as an ATM, is defined as a resource in a CICS TOR. VTAM
establishes a session with the TOR where the initiating remote terminal
is defined. CICS then takes over the transaction routing.

Throughout processing, CICS will invoke VTAM again if any cross-


region communication is needed.

Each CICS system has a TOR with a CSD file where all resources are
defined, including remote terminals such as ATMs.

© 2004 IBM Corporation


IBM ^

3C. Transaction initiation

After VTAM establishes a session


with the CICS TOR, CICS gives the
transaction a name and sends it
back through VTAM to the
appropriate AOR, which might or
might not be in the same CICS
system.

After CICS determines the source of


the transaction and names it, the
application required for processing
the transaction is located by the
AOR.

© 2004 IBM Corporation


IBM ^

3C. Transaction initiation

The AOR also initiates updates by


scheduling a program
specification block (PSB).

The PSB is sent by CICS to IMS,


where it is accepted by DBCTL.
The DBCTL controls the different
functions involved in the database
update.

© 2004 IBM Corporation


IBM ^

3C. Transaction initiation

Like CICS, IMS/DBCTL can be


split into regions, which improves
speed and efficiency in updating
and accessing data.

A multiregion setup consists of


these four regions:

 Control region, which performs


the DBCTL functions contained
in the other regions.

© 2004 IBM Corporation


IBM ^

3C. Transaction initiation

 DL/I region, which actually carries out the update. It contains the DL/I
code, control blocks and buffers for IMS databases, and performs the
accessing and updating of data through DL/I calls.

 DBRC region, which is where logging and recovery information is kept


in case there are problems with the update.

 IRLM region, which functions as a gatekeeper during the actual


database update executed by DBCTL, preventing any accessing of
the database segments being used by the update.

© 2004 IBM Corporation


IBM ^

3C. Transaction completion

Once DBCTL receives the transaction request, it executes the


transaction, retrieves the database segment information and sends the
information back to CICS.

If there are any problems at the database level, they will be logged by
the DBCTL region containing DBRC, which can then be accessed by
CICS in problem determination.

The IRLM prevents any corruption by other transactions requesting the


same database segment as the update. The DL/I region runs and
receives back the completed program to pass on to the DBCTL control
region.

© 2004 IBM Corporation


IBM ^

3C. Transaction completion

Now the transaction path reverses itself.

The completed update is sent back to the CICS AOR, where it is


acknowledged and renamed.

The transaction is then sent on to the original receiving AOR, retracing


its path.

The receiving AOR records the transaction name, logs its completion
level and sends the information on to CICS TOR.

© 2004 IBM Corporation


IBM ^

3C. Transaction completion

A VTAM session is once again initiated, this time from the CICS side.

VTAM takes over the transaction routing, through the security


translation application and out to the system NCP and miniprocessors.

The transaction is then sent out over the network to the remote NCP
and from there to the ATM, where the customer is waiting.

The ATM then issues the requested service, such as a cash withdrawal
or bank balance, to the waiting customer.

© 2004 IBM Corporation


IBM ^

3C. Transaction summary

The role of CICS in this complex


transaction can be summarized
as follows:

 CICS resource definition allows


VTAM to establish a successful
session with CICS TOR.

 The interregion interface


between CICS TOR and AORs
allows CICS to recognize, name
and pass the transaction to the
appropriate region where IMS
programs are located.

© 2004 IBM Corporation


IBM ^

3C. Transaction summary

 The CICS/IMS interface, involving CICS resource definition, resident


utilities and commands, allows efficient handling of the transaction
both going and coming from IMS/DBCTL.

 The CICS information logged during the inward-bound path of the


transaction facilitates the outward handling to VTAM and from there to
the originating remote terminal (ATM).

© 2004 IBM Corporation


IBM ^

Unit 3 summary

This is what you learned in this unit:

 CICS supports both relational and hierarchical database structures.

 Relational databases, such as DB2, structure data in terms of tables


containing predefined data categories.

 Hierarchical databases, such as IMS, structure data in a hierarchy where data


lower in the hierarchy is dependent upon data higher in the hierarchy.

 CICS receives transactions and communicates with other regions through


VTAM.

 IMS/DBCTL, an important interface between CICS and IMS databases, is


often structured into several different regions, including a control region, a
DL/I region, a DBRC region and an IRLM region.

© 2004 IBM Corporation

You might also like