#**********************************************************************#
#*                                                                    *#
#* Copyright (c) 2004 by Sun Microsystems, Inc.                       *#
#* All rights reserved.                                               *#
#*                                                                    *#
#**********************************************************************#


Application Overview
--------------------

This primer application demonstrates the ability of Sun MTP to execute embedded
SQL code within CICS transactions and access a DB2 UDB database.

The application programs are written in C.


Prerequisites and Reference 
---------------------------
Read the Sun MTP Configuration Guide, specifically the chapter
on configuring a region to work with an RDBMS.

Build the Sun MTP executables that will work with DB2 UDB using kixinstall.
Be sure to select DB2/6000 as your RDBMS and choose the default as your 
Application Language.

Make a note of the target directory for the executables that you specify during
the build process.

The Sun MTP Installation Guide contains information on using kixinstall.

Contents of Directories
-----------------------
Programs    :   progs/acct00.ccs, progs/acct01.sqc, progs/acct02.sqc,
                progs/acct03.ccs, progs/acctfet.sqc
Maps        :   maps/ACCTSET.bms
Copybooks   :   progs/ACIXREC.h, progs/ACCTREC.h, progs/ACCTSET.h, progs/histset.h,
                progs/NEW_ACIXREC.h, progs/NEW_ACCTREC.h, progs/OLD_ACIXREC.h,
                progs/OLD_ACCTREC.h
DDLs        :   util/createdemo.sql,  util/dropdemo.sql, util/actrec.ctl, 
		util/acctocrs.ctl
Data files  :   util/acctrec.dat, util/acctocrs.dat
System files:   sys/pct.tbl, sys/ppt.tbl, sys/sit.tbl, sys/vct.tbl,
	        sys/CATALOG.dta, sys/CATALOG.idx
Other       :   makefile, setup, README.txt, progs/tran.exp, progs/sql.exp


Setup Procedure
---------------
1.   Copy the $UNIKIX/examples/db2udb/C directory structure to a new location.

2.   Change to that directory.

3.   Edit the setup file for your environment.

4.   Source the setup file.

Preparing the Application Components
------------------------------------
1.   Log in as the DB2 UDB administrator and bring up a db2 session.

2.   Create the DB2 UDB database:

     db2 => create database unikix authentication client

3.   Log out as the DB2 UDB administrator.

4.   Log in as the Sun MTP user, if necessary.

5.   Create the database tables for the sample application:

     $ db2 -svtf util/createdemo.sql

     The script creates tables in the database 'unikix' which is also the
     database name in the System Initialization Table.  

6.   Load the sample data: 

     $ db2 -svtf util/actrec.ctl
     $ db2 -svtf util/acctocrs.ctl

7.   Compile the application components:

     $ make


Executing the Sample Application
--------------------------------
1.   Start the region.

     $ kixstart

     Note - If you specified a different target directory during the kixinstall
     process, you must use the -t option to specify the path name:

       $ kixstart -t <directory>/unikixtran

2.   Start a Sun MTP session. For example, to start a local client type:

     $ ncd101unikix unikix

3.   On a blank transaction screen, type ACCT, and press Enter.

4.   On the ACCOUNT FILE: MENU screen, type G in the Surname field.

     The Greenfield entries are displayed.

5.   Try the other functions of the application.

Note: The 'P' (print) option is not supported.

6.   When you are finished, press the Clear key to exit the application.



Shutting Down 
-------------
1.   Stop the Sun MTP system using either method:

     - Type the kixstop command at the shell prompt.
     - Type CSMT SHUT,YES on a blank transaction screen.

2.   Delete the database tables for the sample application:

     $ db2 -svtf util/dropdemo.sql

3.   Login as the DB2 UDB administrator and bring up a db2 session.

4.   Delete the 'unikix' database in the DB2 UDB instance: 

     db2 => drop database unikix

5.   Log out as the DB2 UDB administrator.

6.   Log in as the Sun MTP user, if necessary.

7.   Remove all the compiled programs and BMS maps:

     $ make clean

