Blogs

About this blog

Note: The postings on this site solely reflect the personal views of each author and do not necessarily represent the views, positions, strategies or opinions of IBM or IBM management. IBM reserves the right to remove content deemed inappropriate.

Tags

Quickly configure TXSeries with DB2 on Linux

Here is a quick reference guide for you to configure TXSeries with DB2 in XA environment. To aid this, TXSeries provides, “Cheese sample”, This sample consists of a table which contains different types of cheeses and the number of ordered quantity for each cheese. You can use the transaction “UXA1” to query the number of cheeses of particular type that have been ordered and update the same number if required. Follow the below steps to do the same.

1. CREATE THE CHEESE TABLE

The SQL command file creates a database named cicstest. If you do not want to use cicstest as the name of the database, then you need to change the "create database" statement in uxa1.db2.

To create the CHEESE table:

a. Go to DB2 directory

cd /opt/ibm/cics/examples/RM_support/DB2

b. Run below command as instance user.

db2 -f uxa1.db2

Note: To know your instance user run db2 command

db2 get instance

2. CREATE THE REGION USING THE COMMAND(assuming the region name as “txdb2”)

cicscp -v create region txdb2

3. BUILDING THE PROGRAMS

a. Copy the program source, map source, and makefile to the region's bin directory using the command.

cd /opt/ibm/cics/examples/RM_support/DB2

cp uxa1.sqc uxa1.bms uxa1_db2.mk /var/cics_regions/txdb2/bin/

b. Run the make command

cd /var/cics_regions/txdb2/bin

make -f uxa1_db2.mk

c. When the programs have been built, move the map file to the region's map directory as shown:

mv *.map ../maps/prime

4. CONFIGURING THE REGION

a. Use the following commands to add the definitions to the region:

Add a Temporary Storage Data Queue:

cicsadd -c tsd -r txdb2 TEMPXAQ1

Add a Transaction Definition entry:

cicsadd -c td -r txdb2 UXA1 ProgName="UXA1C"

Add Program Definition entries :

cicsadd -c pd -r txdb2 UXA1C PathName="uxa1"

cicsadd -c pd -r txdb2 UXA1 ProgType=map PathName="uxa1m.map"

5. SETTING UP THE XA CONNECTION

a. Build the switchload file.

For two phase commit:

cd /opt/ibm/cics/examples/RM_support/DB2

cp db2xa.c db2xa.mk /var/cics_regions/txdb2/bin/

cd /var/cics_regions/txdb2/bin/

make -f db2xa.mk

For single phase commit:

cd /opt/ibm/cics/examples/RM_support/DB2

cp db21pc.sqc db21pc.mk /var/cics_regions/txdb2/bin/

cd /var/cics_regions/txdb2/bin/

make -f db21pc.mk

b. Define XA connection to the region as described below using the cicsadd command