This chapter describes the installation and use of the BEA TUXEDO Workstation on a DEC Alpha configured with OpenVMS 6.2. This platform offers developers the ability to write application clients using OpenVMS.
The major sections in this chapter cover:
What This Chapter Is About
This section lists the hardware and software prerequisites.
Prerequisites
Hardware
The BEA TUXEDO server machine must have the BEA TUXEDO system and the native-side BEA TUXEDO Workstation installed.
This section covers items specific to building and running a BEA TUXEDO Workstation for OpenVM client program. It is intended to illustrate material presented in the BEA TUXEDO Programmer's Guide and in the BEA TUXEDO COBOL Guide. Our assumption is that readers of this section either have experience in writing OpenVMS programs or have access to tutorial material on that subject. Our presentation is limited to showing you a very simple client, The ATMI calls used in OpenVMS client programs are the same as those described in the chapter entitled "Writing Client Programs" in the BEA TUXEDO Programmer's Guide.
After the BEA TUXEDO Workstation software is installed, among the files in the directory Building and Running a Sample Client Program
simpcl
(from a sample application known as simpapp
). In the code you will see BEA TUXEDO ATMI calls used.
Writing Client Programs
Using simpapp as an Example
$TUXDIR/apps/simpapp
are those shown in Listing 8-1. These are the files needed to produce the simpapp
client for OpenVMS.
Listing 8-1
simpapp Files for OpenVMS
README
simpapp.mk
simpcl.c
simpserv.c
ubbmp
ubbsimple
ubbws
You may find you have additional files; if so, they are extraneous files appropriate for other platforms.
Listing 8-2 shows the source code for simpcl.c
.
Listing 8-2 simpapp for OpenVMS: Client Program
/* #ident "@(#)apps:simpapp/simpcl.c 60.3" */
#include
#include "atmi.h" /* TUXEDO Header File */
#if defined(__STDC__) || defined(__cplusplus)
main(int argc, char *argv[])
#else
main(argc, argv)
int argc;
char *argv[];
#endif
{
char *sendbuf, *rcvbuf;
long sendlen, rcvlen;
int ret;
if(argc != 2) {
(void) fprintf(stderr, "Usage: simpcl string\n");
exit(1);
}
/* Attach to System/T as a Client Process */
if (tpinit((TPINIT *) NULL) == -1) {
(void) fprintf(stderr, "Tpinit failed\n");
exit(1);
}
sendlen = strlen(argv[1]);
/* Allocate STRING buffers for the request and the reply */
if((sendbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
(void) fprintf(stderr,"Error allocating send buffer\n");
tpterm();
exit(1);
}
if((rcvbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
(void) fprintf(stderr,"Error allocating receive buffer\n");
tpfree(sendbuf);
tpterm();
exit(1);
}
(void) strcpy(sendbuf, argv[1]);
/* Request the service TOUPPER, waiting for a reply */
ret = tpcall("TOUPPER", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen,\
(long)0);
if(ret == -1) {
(void) fprintf(stderr, "Can't send request to service TOUPPER\n");
(void) fprintf(stderr, "Tperrno = %d\n", tperrno);
tpfree(sendbuf); tpfree(rcvbuf);
tpterm();
exit(1);
}
(void) fprintf(stdout, "Returned string is: %s\n", rcvbuf);
/* Free Buffers & Detach from System/T */
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
return(0);
}
There are three things to observe in simpcl
; these things illustrate calls you will use a lot as you move on to code client programs for your own applications.
simpcl
calls tpinit
() to attach to BEA TUXEDO as a client. In this case, the call is made without allocating and freeing a TPINIT
buffer. This practice is allowable if you are unconcerned about the client authentication process; in this simple example we are not concerned about it. For further details about this ATMI call, see the tpinit
(3c) reference page.
The next items of interest are the two calls to tpalloc
to get space for send and receive buffers. A full description of tpalloc
(3c) can be found on the tpalloc
(3c) reference page. Note that the space is freed at the end of the program by calls to tpfree
(3c).
The real work of the program is done in the call to tpcall
(3c). tpcall
is a BEA TUXEDO system ATMI function that waits while the server processes its request and sends back the response. An alternative, that may be appropriate if your request takes a while to process, is to use tpacall
(3c) and tpgetreply
(3c). tpacall
issues a service request and checks back later for the reply. More information about tpcall
can be found on the tpcall
(3c) reference page.
In those few lines, you have all the components of a real client program.
Any compiler that can read DEC C libraries can be used to compile application programs.
Use the CFLAGS
environment variable to pass any additional application flags to the DEC C compiler.
Use the TMLKFLAGS
environment variable to pass any additional application flags to the linker.
Use the buildclient
(1) command to build /WS client programs. You should first set the environment by executing the file tux_env.com
. The two commands look like this:
$ @tux-env.com
$ buildclient -w -o wsimpcl.exe -f simpcl.c
When you run client programs, the TUXDIR
environment variable must be set properly before tpinit
(3c) or tpalloc
(3c) is called.
A file of environment variables, tux_env.com
, is delivered with BEA TUXEDO Workstation for OpenVMS. To run the file, use the procedure shown in Listing 8-3.
Listing 8-3 Setting the Environment and Running wsimpcl
$ set default
$ @[]tux_env.com
$ set default[.appx.simpapp]
$ WSNADDR=<host:port>
$ WSTYPE:=VMS
$ wsimpcl:='f$environment("default")'wsimpcl.exe
Replace the values shown (in Listing 8-3) in angle brackets (< >) with values from your location. For TUXDIR
, substitute the name of the root directory where BEA TUXEDO OpenVMS /WS is installed. For WSNADDR
, enter the TCP/IP address for the workstation listener process on your BEA TUXEDO system server. Include the port number if necessary. Check with your system administrator if you need help. For information on the correct format for network addresses, see WSL
(5).
wmio
(1) is not supported.
wtmconfig
(1) is not supported.