Tuxedo
0

Programming a Tuxedo Application Using COBOL

 Previous Next Contents View as PDF  

COBOL Language Bindings for the Workstation Component

This topic includes the following sections:

Refer to Using the BEA Tuxedo Workstation Component for more information on the Workstation platform.

 


UNIX Bindings

The following sections describe how to write and build client programs, and set appropriate environment variables when developing, in COBOL, a BEA Tuxedo application on a UNIX platform.

Writing Client Programs

You can develop COBOL client programs for a UNIX platform in the same way that you develop COBOL clients in the BEA Tuxedo administrative domain. All ATMI calls are available.

Building Client Programs

To compile and link-edit Workstation client programs, use the buildclient(1) command. If you are building a UNIX Workstation client on the native node, use the -w option to have the client built using the Workstation libraries.

If you are building a client on a native node, and both native and Workstation libraries are present, the native libraries are used by default. In this case, specifying the -w option ensures that the correct libraries for a Workstation client are used.

On a workstation, where only the Workstation libraries are present, it is not necessary to specify -w.

The following example shows how to use the buildclient command on a native node.

Listing 12-1 Example of Running buildclient on a UNIX Platform

ALTCC=cobcc ALTCFLAGS="-I /APPDIR/include"
COBCPY=$TUXDIR/cobinclude
COBOPT="-C ANS85 -C ALIGN=8 -C NOIBMCOMP -C TRUNC=ANSI -C OSEXT=cbl"
export COBOPT COBCPY ALTCC ALTCFLAGS
buildclient -C -w -o empclient -f name.cbl -f "userlib1.a userlib2.a"

The -o option enables you to specify a name for your output file. Input files specified with the -f option are linkedited before system libraries.

As illustrated, the TUXDIR environment variable must be used to ensure that the buildclient command can locate system libraries. Be sure that you have defined TUXDIR. The CC environment variable defaults to cc, but can be set to another compiler through ALTCC.

Setting Environment Variables

Workstation clients make use of several environment variables.

The following table lists the environment variables that are checked by TPINITIALIZE when a Workstation client attempts to join an application.

Table 12-1 Environment Variables Checked by TPINITIALIZE on a UNIX Platform

Environment Variable

Description

WSENVFILE

Name of a file containing environment variable settings to be used in the client's environment.

WSNADDR

Network address of the Workstation listener process through which the client gains access to the application. Use the value specified in the application configuration file for the Workstation listener to be called. If the value begins with the characters 0x, the system interprets it as a string of hexadecimal digits; otherwise, the system interprets it as ASCII characters.

WSDEVICE

Name of the device to be used to access the network. Not required by all transport layer interfaces.

WSTYPE

Workstation type. Used by TPINITIALIZE when that call is invoked by a Workstation client to negotiate encode/decode responsibilities with the native site. If you do not specify WSTYPE, the system performs encoding, even if WSTYPE is not specified on the native site, either. You must explicitly specify the same WSTYPE value for both the native and Workstation client sites to ensure that the encode/decode feature is turned off.

WSRPLYMAX

Maximum amount of core memory that the ATMI uses for buffering application replies before dumping them to disk. Used by TPINITIALIZE. The default system limit is 256,000 bytes. Whether you should use WSRPLYMAX to set a lower limit depends on the amount of memory available on your machine. Writing replies to disk causes a substantial reduction in performance.

WSFADDR

The network address used by the Workstation client when connecting to the Workstation listener or Workstation handler. This variable, along with the WSFRANGE variable, determines the range of TCP/IP ports to which a Workstation client will attempt to bind before making an outbound connection. This address must be a TCP/IP address.

WSFRANGE

The range of TCP/IP ports to which a Workstation client process attempts to bind before making an outbound connection. The WSFADDR parameter specifies the base address of the range. The default is 1.

Other environment variables may be needed by Workstation COBOL clients on a UNIX workstation, depending on which components of the BEA Tuxedo system are being used.

Note: MicroFocus delivers LIBNSL.a as a shared object, which is required by buildclient when linking a Workstation client. Because MicroFocus COBOL does not support shared objects on UNIX 3.2, Workstation for UNIX 3.2 is not supported.

 


Microsoft Windows Bindings

The following sections describe how to write and build client programs, build ACCEPT/DISPLAY clients, block network behavior, and restore the network environment when developing, in COBOL, a BEA Tuxedo application for the Microsoft Windows platform.

Writing Client Programs

All program-specific ATMI calls are available.

Building Client Programs

To compile the COBOL source files that call the ATMI, you must use the COBOL compiler with the LITLINK option. To linkedit the Workstation client object files, use the buildclient(1) command. While the syntax of the command is straightforward, the usage varies according to the compilation system used.

The following example shows how to use the buildclient command.

Listing 12-2 Example of Running buildclient on a Windows Platform

COBCPY=C:\TUXEDO\COBINC
COBDIR=C:\COBOL\LBR;C:\COBOL\EXEDLL
PATH=C:\COBOL\EXEDLL;...
TUXDIR=C:\tuxedo
LIB=C:\NET\TOOLKIT\LIB;C:\MSVC\LIB;C:\TUXEDO\LIB;C:\COBOL\LIB
buildclient -C -o EMP.EXE -f EMP -f "/NOD/NOI/NOE/CO/SE:300" -l WLIBSOCK
For Windows NT:
buildclient -C -o EMP.EXE  -f empobj 

The following table describes the buildclient command options used in the preceding example.

Table 12-2 buildclient Command Options for Windows Platform

Option

Description

-o name

Name of the executable file being created. The default is client.exe.

-f firstfiles

One or more object files to be included before the BEA Tuxedo libraries. You can use the -f option to pass options to the compiler or linker. To specify more than one filename, enter a list of files after -f, using white space to separate filenames and double quotation marks around the list. You can also specify multiple filenames using multiple occurrences of the -f option on the command line.

-l libfiles

Libraries to be included after the BEA Tuxedo libraries. To specify more than one filename, you must separate the names by white space and enclose the list in quotation marks. You can also specify multiple filenames using multiple occurrences of the -l option on the command line.

Building ACCEPT/DISPLAY Clients

The following example shows how to build an executable client for an ACCEPT/DISPLAY application, such as CSIMPAPP.

Listing 12-3 Building ACCEPT/DISPLAY clients

a) compile the COBOL module and create a file.obj
cobol file.cbl omf(obj) litlink;
b) use the following link statement
link FILE+cblwinaf,,,\
wcobatmi+cobws+wtuxws+ \
lcobol+lcoboldw+cobw+cobfp87w+ \
wlibsock,FILE.def /nod/noe;
For Windows NT the link statement is:
cbllink -oEMP.exe EMP.obj \
cobws.lib ncobatmi.lib wtuxws32.lib \
libcmt.lib user32.lib

 

Back to Top Previous Next
Contact e-docsContact BEAwebmasterprivacy