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

Application Overview
--------------------
This application demonstrates the use of WebSphere MQ trigger monitoring
within a Sun MTP environment.

This application is written in COBOL.


Prerequisites and Reference
---------------------------

Perform the following tasks:

1.  Install and configure WebSphere MQ Client on the same system where the 
    Sun MTP region is running.

2.  Install and configure WebSphere MQ Server on a host that is accessible 
    to the Sun MTP host via TCP/IP communications.  
    
    This example assumes that Sun MTP and MQ Server are running on the same
    host.  
   
3.  If Sun MTP and MQ Server are not running on the same host, you must
    compile the kixmqtst program on the host that is running MQ Server.
    
    a.  Copy the C source files and the data file MQCOBAppl_GetAlias.data to 
        the host running MQ Server. 
    
    b.  Build the application according to compiler and MQ specifications for 
        that host.
        
4.  From the MQ administrator, get the port number for the MQ listener.
   
    You will need this information when you are executing the application.

Refer to the Sun MTP Configuration Guide for information about configuring
the unikixrc.cfg file for MQ clients. Refer to the Sun MTP Developer's
Guide for information about using MQ with Sun MTP.


Contents of Directories
-----------------------
MTP Programs :   progs/KIXMQ01.cl2, progs/kx_cobopt
MQ Programs  :   progs/kixmqtst.c, progs/kixmqerr.c, progs/kixmqerr.h
MQ Config    :   util/kixmqtst.mqconfig, util/MQCOBAppl_GetAlias.data
MTP Region   :   sys/pct.tbl, sys/ppt.tbl sys/snt.tbl, sys/unikixrc.cfg
Other        :   makefile, setup, README.txt

Setting Up and Building the Region Executables
----------------------------------------------
1.  Copy the $UNIKIX/examples/mq/cobol_mf directory structure to a new
    location.

2.  Change to that directory.

3.  Edit the setup file for your environment.

4.  Source the setup file.

5.  Change to the sys directory.

6.  Verify that the following lines are in the unikixrc.cfg file:

       MQServer*Active:            True
       MQServer*QueueManagerName:  "TESTQM"
       MQServer*QueueName:         "UNIKIX.TRIGGER.QUEUE"
          
7.  Change to the $UNIKIX/src directory.

8.  Build the region executables using kixinstall. 

    Be sure to select MQ from the Third Party Packages screen. Verify
    that COBOL is selected as your language.

Preparing the Application Components
------------------------------------

1.  Change to the MQ sample application directory you created in the
    procedure "Setting Up and Building the Region Executables."

2.  Compile the application components:

     $ make


Starting the Region
-------------------
1.  Start the region.

     $ kixstart


Executing the Sample Application
--------------------------------

Perform the following tasks on the MQ Server host machine. If you need to 
check on the health of the queue managers on your the server, type the dspmq 
command at a command prompt. 

1.  Create an MQ queue manager named TESTQM.

       crtmqm -lf64 -q TESTQM

    The following messages are displayed:
       MQSeries queue manager created.
       Creating or replacing default objects for TESTQM.
       Default objects statistics : 29 created. 0 replaced. 0 failed.
       Completing setup.
       Setup completed.

2.  Start the TESTQM queue manager using the strmqm command.

       strmqm TESTQM

    The following message is displayed:
       MQSeries queue manager 'TESTQM' started.

3.  Put the sample configuration into the queue manager using the runmqsc
    command.
       runmqsc TESTQM < util/kixmqtst.mqconfig

4.  Start the listener with the following command:

       runmqlsr -t tcp -m TESTQM -p nnn &

       (nnn is the port number)

5.  Put data into the queue.

       kixmqtst -m TESTQM -q UNIKIXMQ1 -i util/MQCOBAppl_GetAlias.data

    The following message is displayed:
	kixmqtst: Writing file to [TESTQM][UNIKIXMQ1] ... Done

    A short time later, the following messages are displayed:
        KIXMQ01: Queue Manager is TESTQM
        KIXMQ01: Queue is UNIKIXMQ1                                       
        KIXMQ01: ended

6.  To verify that the data from the MQ queue was properly processed:

    a. Execute the Sun MTP transaction CEBR on a blank transaction screen.

    b. In the command area of the CEBR screen type:
    
       Q MQTEST01  
       
    c. Press Enter.

       The data from the MQ queue was written to a temporary storage queue 
       named MQTEST01.

       The MQTEST01 queue data should display on the screen.

Shutdown procedures
-------------------
1.  Stop the Sun MTP system using either method:

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

2.  Stop the queue managers:

       endmqm TESTQM

    The following message is displayed:
       Quiesce request accepted. The queue manager will stop when all
       outstanding work is complete.

3.  Stop the listener:

       endmqlsr -m TESTQM

    The following message is displayed:
       An MQSeries listener will end shortly.

4.  Delete the TESTQM queue manager:

       dltmqm TESTQM

    The following message is displayed:
        MQSeries queue manager deleted
