IBM DB2 RM Switch Module

Provides the information required to build the IBM DB2 RM switch module.
Restriction: This topic applies only when the Enterprise Server feature is enabled.

Windows Environments

Source Code
The IBM DB2 RM switch module COBOL source file, ESDB2XA.CBL is located by default in the %ProgramFiles(x86)%\Micro Focus\Visual COBOL\src\enterpriseserver\xa directory.
Note: If you prefer to supply user credentials programatically rather than in the xa_open string, instructions for doing so are provided in the COBOL source file in the Customization section.
Building the Switch Module
You can use either of the following methods to build the IBM DB2 switch module:
Method 1
  1. Start a Visual COBOL command prompt, 32-bit or 64-bit depending on the application, running as an administrator.
  2. Change to the %ProgramFiles(x86)%\Micro Focus\Visual COBOL\src\enterpriseserver\xa directory (default location).
  3. Enter build db2
Method 2
  1. Start a Visual COBOL command prompt, 32-bit or 64-bit depending on the application.
  2. Copy all files from the %ProgramFiles(x86)%\Micro Focus\Visual COBOL\src\enterpriseserver\xa directory (default location) to any location where you have WRITE permission.
  3. Change to the directory containing the copied files.
  4. Enter build db2
Build Output
The build process produces two binary files from the ESDB2XA.CBL COBOL source file:
Binary File Type
ESDB2XA_S.DLL static
ESDB2XA.DLL dynamic

You can register an RM switch module with Enterprise Server dynamically, or register it statically depending on which binary file you use. We recommend that you use the dynamic switch module option, as this ensures that only active databases used in the global transaction participate in the TM/RM XA flow.

UNIX Environments

Source Code
The IBM DB2 RM switch module COBOL source file, ESDB2XA.CBL is located by default in the $COBDIR/src/enterpriseserver/xa directory.
Note: If you prefer to supply user credentials programatically rather than in the xa_open string, instructions for doing so are provided in the COBOL source file in the Customization section.
Building the Switch Module
The $COBDIR/src/enterpriseserver/xa directory contains the build batch file that you can use to build the IBM DB2 switch module:
  1. Copy all files from the $COBDIR/src/enterpriseserver/xa directory (default location) to any location where you have WRITE permission.
  2. Change to the directory containing the copied files.
  3. Enter build db2 [-o]

    The optional -o parameter allows both DB2 and ODBC (accessing DB2) switch modules to be enabled in the same region.

Build Output
The build process produces two binary files from the ESDB2XA.CBL COBOL source file:
ESDB2XA_S.so 32-bit static
ESDB2XA64_S.so 64-bit static
ESDB2XA.so 32-bit dynamic
ESDB2XA64.so 64-bit dynamic

You can register an RM switch module with Enterprise Server dynamically, or register it statically depending on which binary file you use. We recommend that you use the dynamic switch module option, as this ensures that only active databases used in the global transaction participate in the TM/RM XA flow.

All Environments

Additional Resources
For more information on using the IBM DB2 RM switch module, including the open string definition and details of supported SQL operations, see the following:
  • The Database Access - DB2 ECM topic under Additional Software Requirements
  • The Transaction Managers help topic available in the IBM RDBMS documentation.
  • DB2 9.1 - The X/Open XA Interface programming considerations help topic available in the IBM RDBMS documentation.