Environment Configuration

This chapter describes how to configure an environment to develop a COBOL program.

1. Directory Structure

The following describes a COBOL-related directory structure.

$TMAXDIR
|--lib
|--cobinc
|--config
|--ucblinc
+--sample
     |-- cobserver
     |-- cobclient
lib

Contains COBOL library files.

cobinc

Contains COBOL header files (*.cbl).

config

Contains the Tmax configuration file with which COBOL sample files can be tested.

ucblinc

Contains field keys, view files, and other files required for COBOL sample files that use a field buffer.

sample

Contains the following subdirectories.

Subdirectory Description

cobserver

Contains sample service programs.

cobclient

Contains sample client programs.

For more information about how to install a Tmax engine, refer to Tmax Installation Guide.

COBOL Library Files

$TMAXDIR/lib must contain COBOL library files.

$ ls -l $TMAXDIR/lib/libcbl*
-rwx------1 tmax dba 252461 Apr 22 12:53 /user/tmax3815/lib/libcblc.so*
-rw-------1 tmax dba 351420 Apr 22 12:52 /user/tmax3815/lib/libcbls.a

2. Setting Environment Variables

To develop a service in COBOL, set the Tmax and COBOL environments as follows.

#####  Tmax system Environment

TMAXDIR=<Tmax installation path>
TMAX_HOST_ADDR=<IP address of a Tmax system>
TMAX_HOST_PORT=<Port number of a Tmax system>
SDLFILE=$TMAXDIR/ucblinc/tmax.sdl
FDLFILE=$TMAXDIR/sample/fdl/tmax.fdl
PATH=$TMAXDIR/bin:$PATH
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TMAXDIR/lib:$TMAXDIR/tuxlib
export TMAXDIR TMAX_HOST_ADDR TMAX_HOST_PORT
export SDLFILE FDLFILE PATH LD_LIBRARY_PATH

#####  MF Cobol Environment

COBCPY=$TMAXDIR/cobinc:$TMAXDIR/ucblinc
COBDIR=<Cobol compiler installation path>
PATH=$PATH$COBDIR/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COBDIR/lib
export COBCPY COBDIR PATH LD_LIBRARY_PATH

The above LD_LIBRARY_PATH must be replaced with LIBPATH in IBM AIX and SHLIB_PATH in UP-UX.

3. Setting a Configuration File

The following are the steps for creating and setting the Tmax configuration file.

  1. Create the configuration file.

    *DOMAIN
    tmax1   SHMKEY =99990, TPORTNO=9389,  BLOCKTIME=60,
    MAXSVC=100, MAXSVR=50, MAXSPR=100, MAXTMS=10,IPCPERM=0666
    
    *NODE
    tmax5   TMAXDIR = "/user/tmax3815",
            APPDIR  = "/user/tmax3815/appbin",
            PATHDIR = "/user/tmax3815/path",
            TLOGDIR = "/user/tmax3815/log/tlog",
            ULOGDIR = "/user/tmax3815/log/ulog",
            SLOGDIR = "/user/tmax3815/log/slog"
    
    *SVRGROUP
    svg1    NODENAME = "edu25"
    
    ### tms for Oracle ###
    svg2    NODENAME = "edu25",     DBNAME = ORACLE,
            OPENINFO = "Oracle_XA+Acc=P/scott/tiger+SesTm=60 ",
            TMSNAME  = tms_ora
    
    *SERVER
    carray_nxa     SVGNAME = svg1, MIN=1, MAX=1,
                   CLOPT="-e $(SVR).err -o $(SVR).out -- scott tiger"
    svctpcall      SVGNAME = svg1, MIN=1, MAX=1,
                   CLOPT="-e $(SVR).err -o $(SVR).out"
    fdlins         SVGNAME = svg1, MIN=1, MAX=1,
                   CLOPT="-e $(SVR).err -o $(SVR).out"
    carray_xa      SVGNAME = svg2, MIN=1, MAX=1,
                   CLOPT="-e $(SVR).err -o $(SVR).out"
    
    *SERVICE
    CARRAYNXA      SVRNAME = carray_nxa        # carray buffer, non-xa
    FDLINS         SVRNAME = fdlins            # field buffer, non-xa
    CARRAYAUTO     SVRNAME = carray_xa,        # carray buffer, xa ,
                   AUTOTRAN=Y                    using autotran
    CARRAYNAUTO    SVRNAME = carray_xa         # carray buffer, xa ,
                                                 explicit transaction
    SVCTPCALL      SVRNAME = svctpcall         # carray buffer, use
                                                 tpcall in service
  2. Compile the configuration file and create a service table.

    Compile the text-based Tmax configuration file into a binary file with the cfl command. The binary file is saved in $TMAXDIR/config with the default name of tmconfig.

    $ cfl –i cobol.m
    $ls –l $TMAXDIR/config
    -rw-r--r-- 1 tmax dba 793256 Apr 24 09:50 cobol.m
    -rw-r--r-- 1 tmax dba 793256 Apr 24 09:50 tmconfig
    $ gst
    $ ls –l $TMAXDIR/svct
    -rw-r--r-- 1 tmax dba 385 Apr 24 17:50 carray_nxa_svctab.c
    -rw-r--r-- 1 tmax dba 491 Apr 24 17:50 carray_xa_svctab.c
    -rw-r--r-- 1 tmax dba 373 Apr 24 17:50 fdlins_svctab.c
    -rw-r--r-- 1 tmax dba 385 Apr 24 17:50 svctpcall_svctab.c

    For more information about how to create a TMS (Transaction Management Server) file, refer to Tmax Administration Guide.

  3. Start an engine.

    $ tmboot –T
    TMBOOT for node(tmax5) is starting:
    TMBOOT: TMM is starting: Thu Apr 24 12:09:17 2003
    TMBOOT: CLL is starting: Thu Apr 24 12:09:17 2003
    TMBOOT: CLH is starting: Thu Apr 24 12:09:17 2003
    TMBOOT: TMS(tms_ora) is starting: Thu Apr 24 12:09:17 2003
    TMBOOT: TMS(tms_ora) is starting: Thu Apr 24 12:09:17 2003

4. Installing a Sample File

A sample file (cobolsample.tar) is provided. The file includes a configuration file, a server program, a server Makefile, and tmd modules for testing whether a service operates normally. Since it is assumed that a Tmax engine is already installed, the sample file copies only the files necessary for COBOL. Therefore, a Tmax engine must be installed before installing cobolsample.tar.

Install the sample file in $TMAXDIR using the following command. Since the file was compressed with tar, use the "-xvf" option to extract cobolsample.tar like the directory structure.

$ cd $TMAXDIR
$ tar -xvf cobolsample.tar
  x ./config/cobol.m, 1709 bytes, 4 tape blocks
  x ./ucblinc x ./ucblinc/viewdemo.v, 382 bytes, 1 tape blocks
  x ./ucblinc/viewdemo.h, 190 bytes, 1 tape blocks
  x ./ucblinc/VIEWDEMO.cbl, 671 bytes, 2 tape blocks ……
  x ./lib/libcblc.so, 252805 bytes, 494 tape blocks
  x ./lib/libcbls.a, 352024 bytes, 688 tape blocks
$ cd $TMAXDIR
$ tar -xvf cobolsample.tar
  x ./config/cobol.m, 1709 bytes, 4 tape blocks
  x ./ucblinc x ./ucblinc/viewdemo.v, 382 bytes, 1 tape blocks
  x ./ucblinc/viewdemo.h, 190 bytes, 1 tape blocks
  x ./ucblinc/VIEWDEMO.cbl, 671 bytes, 2 tape blocks
  ……
  x ./lib/libcblc.so, 252805 bytes, 494 tape blocks
  x ./lib/libcbls.a, 352024 bytes, 688 tape blocks