PreviousPackaging Applications Creating ProgramsNext

Chapter 4: Working in 32-bit and 64-bit Modes

This chapter describes how to use Server Express in 32-bit mode or 64-bit mode. You need only read this chapter if you have installed the 64-bit version of Server Express.

4.1 Introduction

If your UNIX platform supports the execution of 64-bit applications, then Server Express 2.0 for that platform is installed with both a 32-bit version and 64-bit version of the Server Express development and run-time systems. This enables you to write programs that can be run on both 32-bit and 64-bit systems, and to migrate applications from 32-bit systems to 64-bit systems.

The development tools, run-time libraries and run-time system for both the 32-bit and 64-bit version of Server Express are located in the $COBDIR directory.

You can specify a working mode for Server Express; that is, whether the default development system is the 32-bit system or the 64-bit system. Whichever working mode you specify, you can always use tools that work in the other mode. For example, if you set Server Express to work in 32-bit mode by default, you can still run 64-bit versions of the tools and utilities.

4.2 Finding the Current Working Mode

The working mode can be global or local. The global working mode affects all users of the development system. The local working mode is specific to your local environment.

You can find out your working mode by using the cobmode command as follows:


To find your current local working mode, enter the command:

cobmode -l

To find the current global working mode, enter the command:

cobmode -s 

If you want to know how your working mode is determined add the -v option to the cobmode command line. For example:

cobmode -v

To set the working mode, see the section Setting the Working Mode.

4.3 Setting the Working Mode

You can specify the working mode when you install Server Express 2.0. This is described in your Installation Notes.

You can set the working mode at any time using the:

4.3.1 The $COBMODE Environment Variable

Use the $COBMODE environment variable to set your local working mode. The value you set using $COBMODE overrides the global working mode.

The format of $COBMODE is:


where version can be 32 or 64.

For example, to set the local working mode to the 64-bit development mode:

export COBMODE

4.3.2 The cobmode Command

To set the global working mode use the cobmode command.

The format of the cobmode command used to set the global working mode is:

cobmode -s version

where version can be 32 or 64 .

For example, to set the global working mode to the 64-bit version:

cobmode -s 64

4.4 Default Working Mode

The working mode defaults to a particular mode depending on what parts of the product have been installed, and to what values the local and global working modes have been set.

The working mode is determined using the following rules, listed in order, most significant first:

4.5 Starting the Required Tool

The tools and utilities provided with Server Express 2.0 are provided in both 32-bit and 64-bit versions. They are suffixed with either 32 or 64 as appropriate. The tools and utilities are also provided in unnumbered versions. You do not need to alter the values for $PATH, $COBDIR, and $LD_LIBRARY_PATH, $LIBPATH or $SHLIB_PATH in order to switch between working modes.

For example:

cob32 -i myprog.cbl
cobrun32 myprog

compiles the program myprog.cbl to the 32-bit intermediate code file, and then runs it.

cob64 -i myprog.cbl
cobrun64 myprog

compiles the program myprog.cbl to the 64-bit intermediate code file, and then runs it.

For development tools (such as the Cob utility), the unnumbered versions always obey the current working mode. See the section Default Working Mode.

For cobrun and Animator, the unnumbered versions locate the application named on the command line and automatically run it in the correct mode. If the named application cannot be located, these tools obey the current working mode.

For example:


runs in 64-bit mode. If is a 32-bit application then a run-time error occurs.


runs in either 32-bit or 64-bit mode, as appropriate, depending on which mode was compiled to.

anim myapp

runs Animator, using myapp, in either 32-bit or 64-bit mode, as appropriate, depending on which mode was compiled to.

These examples are true for .int files, .gnt files and callable shared objects. However, system executable files are run in the same way for both 32-bit and 64-bit modes. For example, you can create and run 32-bit and 64-bit system executable files from the program myprog.cbl as follows:

cob32 -x myprog.cbl
cob64 -x myprog.cbl

4.6 Shipping Dual-mode Programs

If you ship an application that contains both 32-bit and 64-bit versions of your programs, you can either:

4.7 Configuration Files

You can configure various utilities, and the run-time system, using configuration files.

Configuration files that effect the run-time system, such as cobconfig, have no suffix whatever version of Server Express you are using. In this case, the settings are shared between the 32-bit and 64-bit versions.

Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousPackaging Applications Creating ProgramsNext