Created On:  11 February 2011

Problem:

Is it possible to use more than one version of Server Express on the same UNIX or Linux machine?  If so, how do you switch back and forth between using different versions of Server Express?

Resolution:

You switch back and forth between different versions of Server Express on the same machine, by setting three particular environment variables.

The first is COBDIR.  This environment variable must be set to the directory where the version of Server Express resides.  Each version of Server Express must be installed in a separate directory.  Switching the value of COBDIR to the appropriate directory is the most important step in changing the version of COBOL you are using.  For example, if you have installed a version in /opt/microfocus/cobol, you could enter the commands:

COBDIR=/opt/microfocus/cobol
export COBDIR

The second is the PATH environment variable.  This should be set to include $COBDIR/bin -- in other words, the sub-directory of $COBDIR named "bin," where driver programs such as cob, cobrun, and anim are found.  PATH is a colon-separated list of directories, and it is an important variable in UNIX or Linux.  Besides $COBDIR/bin, it must also include directories where standard UNIX commands are found.

You should place $COBDIR/bin first on the PATH, followed by whatever else was already on the PATH, using this technique:

PATH=$COBDIR/bin:$PATH
export PATH

The third environment variable is the one that tells the system where to look for shared libraries.  On most UNIX or Linux systems, it is named LD_LIBRARY_PATH.  However, on AIX systems it is named LIBPATH, and on HP/UX PA-RISC systems it is named SHLIB_PATH.  For the rest of this discussion, we will use LD_LIBRARY_PATH (substitute the appropriate name if you are using AIX or HP/UX PA-RISC).

Micro Focus shared libraries are kept in a sub-directory beneath $COBDIR named "lib".  You should add $COBDIR/lib to LD_LIBRARY_PATH like so:

LD_LIBRARY_PATH=$COBDIR/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

Having set these three environment variables, a person can be confident they are using a particular version of Server Express.

To make it easy to change back and forth between versions, you can establish some shell functions in the .profile that gets executed each time the user logs in.   Consider this example:

ORIG_PATH=$PATH
sx51()
{
COBDIR=/opt/sx51
PATH=$COBDIR/bin:$ORIG_PATH
LD_LIBRARY_PATH=$COBDIR/lib
export COBDIR PATH LD_LIBRARY_PATH
}

sx51wp5()
{
COBDIR=/opt/sx51wp5
PATH=$COBDIR/bin:$ORIG_PATH
LD_LIBRARY_PATH=$COBDIR/lib
export COBDIR PATH LD_LIBRARY_PATH
}

This example assumes version 5.1 of Server Express is installed in /opt/sx51, and version 5.1 WrapPack 5 is in /opt/sx51wp5.  Substitute appropriate values for the installations on your machine.

These commands in the .profile will define "shell functions" each time the user logs in.  The user needs merely to enter "sx51" or "sx51wp5" on the command line, to quickly switch back and forth between versions.
Incident #2475733