Quickly configure TXSeries with DB2 on Linux
Aravind.P 270006FCNY Visits (2289)
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
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.
cp uxa1.sqc uxa1.bms uxa1_db2.mk /var
b. Run the make command
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 Path
5. SETTING UP THE XA CONNECTION
a. Build the switchload file.
For two phase commit:
cp db2xa.c db2xa.mk /var
make -f db2xa.mk
For single phase commit:
cp db21pc.sqc db21pc.mk /var
make -f db21pc.mk
b. Define XA connection to the region as described below using the cicsadd command
cicsadd -c xad -r txdb2 XADdef Swit
Note : You can set SwitchLoadFile attribute to db2xa or db21pc switchload files which were built in the previous step.
c. Grant privileges to the database using the below commands. You need to execute the below command as the instance user.
db2 connect to cicstest
db2 grant connect on database to user cics
db2 grant select on table sysibm.sysindexes to user cics
db2 connect reset
6. STARTING THE REGION AND RUNNING THE TRANSACTION.
Ensure you set the below variables in region's environment file
Cold start the region
cicscp -v start region txdb2 StartType=cold
Once the region is up and running, use cicslterm command as below:
cicslterm -r txdb2
Type “UXA1” to run the transaction.
Follow the below screen shots to complete the transaction.
The cheeses you can order are stilton, wensleydale, cheddar, brie, camembert, edam, cheshire, gouda, red leicester, and boursin.
Also you can find information on setting up TXSeries with DB2 here .