Tuxedo
This chapter describes how to use COBOL-IT with Oracle Tuxedo. For specifics about the installation and configuration of Tuxedo, please refer to the Oracle documentation section.
Oracle Tuxedo is available on all of the platforms to which COBOL-IT is Supported. Oracle Tuxedo delivers powerful transaction monitoring technology aimed at facilitating the development and deployment of SOA applications. Oracle Tuxedo provides Client libraries, and Server-based software, and a published API that is accessible by many programming languages, and perhaps most notably, the COBOL programming language. As a result, it is easy to create front-end programs in COBOL which initialize and communicate with the middleware, as it is to use the Server to initiate services written in COBOL.
In a distributed processing (client/server) environment, the interaction between COBOL-IT and Tuxedo occurs as shown in the following diagram:
COBOL-IT Front-end < > Tuxedo Client Software < > Tuxedo Server < > COBOL-IT Services
Useful references on building Tuxedo clients using the Tuxedo buildclient script can be located at Tuxedo Buildclient.
Useful references on building a Tuxedo server using the Tuxedo buildserver script can be located at Tuxedo Buildserver.
When transitioning from another COBOL compiler that uses the Tuxedo buildserver script, it is important to understand that cobc
builds a “`main”, which is the entry point for a C program.
To cause COBOL-IT to not build a “main”, you must use the compiler flag –fno-main
. For your purposes when integrating with Tuxedo, this can be handled by setting the environment variable COBITOPT
to include the -fno-main
setting.
See Passing COBOL-IT compiler flags using COBITOPT
for more details.
“cobmf”- the COBOL-IT MF Command-line Emulator
cobmf
, or cobmf.exe
in Windows environments, is located in the $COBOLITDIR\bin
directory. For a full list of compiler flags supported by cobmf
, just type cobmf [return]
at the command line.
cobmf
facilitates the transition from Micro Focus COBOL to COBOL-IT by providing a Micro Focus command-line emulator. The user can rename cobmf
to cob
(or rename cobmf.exe
to cob.exe
in Windows environments), and continue to use the same compiler flags and environment variables that they have developed over time.
Due to the high level of compatibility with Micro Focus that COBOL-IT provides with its MF command line emulator cobmf
, current documentation provided by Tuxedo for use with Micro Focus COBOL can be used by COBOL-IT users, with just a few adjustments, documented below.
Note how this applies, when referencing Tuxedo documentation, which was developed for use with the Micro Focus compiler cob
, and where a number of Micro Focus environment variables are referenced. Using cobmf
(renamed as cob
), directs the COBOL-IT compiler to reference these, rather than the equivalent versions used by the COBOL-IT compiler cobc
. cobmf
thus provides a powerful tool in transitioning, as scripts such as the one below, used to document how to set up the environment to run the Oracle Tuxedo sample with a COBOL client program, can be used “as is”:
From: Tuxedo Tutorial
APPDIR=<pathname of your present working directory>
TUXCONFIG=$APPDIR/TUXCONFIG
COBDIR=<pathname of the COBOL compiler directory>
COBCPY=$TUXDIR/cobinclude
COBOPT="-C ANS85 -C ALIGN=8 -C NOIBMCOMP -C TRUNC=ANSI -C OSEXT=cbl"
CFLAGS="-I$TUXDIR/include"
PATH=$TUXDIR/bin:$APPDIR: $PATH
LD_LIBRARY_PATH=$COBDIR/coblib:${LD_LIBRARY_PATH}
export TUXDIR APPDIR TUXCONFIG UBBCONFIG COBDIR COBCPY
export COBOPT CFLAGS PATH LD_LIBRARY_PATH
In the script above, cobmf
/cob
recognizes COBOPT
, COBCPY
, and COBDIR
, and reproduces the expected behaviors associated with those COBOL-oriented environment variables, while also recognizing all of the compiler flags listed in the COBOPT
environment variable, and applying those, when using the COBOL compiler.
Configuring, Compiling and Linking Tuxedo programs
To configure, compile, and link Tuxedo programs:
- Rename
cobmf
ascob
. - Ensure that
cobmf
/cob
is in yourPATH
. - Use the Tuxedo-provided
buildclient
andbuildserver
scripts, adding a reference tocittuxedo.c
, as described below.
Passing COBOL-IT compiler flags using COBITOPT
The tuxedo-provided buildclient
or buildserver
make use of a convention, in which the –C
flag indicates that a COBOL compiler cob
should be used, and the compiler flags should be stored in the environment variable COBOPT
and COBITOPT
. Note that COBITOPT
is needed only for the compiler flags that are not supported by COBOPT
.
To compile programs correctly for tuxedo, COBOL-IT compiler needs the followings flags:
export COBITOPT=”-fno-main –conf=+tuxedo.symb”
For cases, such as the Tuxedo sample program, where command line parameters are required, the COBOL-IT compiler flag –fC-cmd-line
is also required.
The version 11g of tuxedo provides a COBOL sample called CSIMPAPP
. The client part of that sample reads command line parameters with the code below:
LINKAGE SECTION.
01 OS-LEN PIC S9(9) COMP.
02 OS-STRING.
03 PARMPTR-TABLE OCCURS 1 TO 100 TIMES DEPENDING ON OS-LEN.
01 PARMPTR POINTER.
01 PARM-STRING PIC XXXXXX.
*******************************************************
*Start program with command line args
*******************************************************
PROCEDURE DIVISION USING BY VALUE OS-LEN BY REFERENCE OS-STRING.
To compile this correctly, the COBOL-IT compiler requires the compiler flag -fC-cmd-line
. As a result, the script for building this sample requires the setting of COBITOPT
, as follows:
In Linux/Unix:
export COBITOPT=”-fno-main -conf=+tuxedo.symb -fC-cmd-line“
buildclient -C -o CSIMPCL -f CSIMPCL.cbl
export COBITOPT=”-fno-main -conf=+tuxedo.symb”
In Windows:
set COBITOPT=”-fno-main -conf=+tuxedo.symb -fC-cmd-line“
buildclient -C -o CSIMPCL -f CSIMPCL.cbl
set COBITOPT=”-fno-main -conf=+tuxedo.symb”