Application Building Guide

Setting the OS/2 Environment

Most OS/2 compilers use environment variables to control various options. You can set these variables in your CONFIG.SYS file, or you can create command files to set them.

CONFIG.SYS
The advantage of setting the environment variables in your CONFIG.SYS file is that once entered, they are set every time you start (boot) your computer.

Command File
The advantage of setting the environment variables in a command file is that you can have a shorter path and the flexibility to use several compilers. The disadvantage is that you must run the command file at the start of each programming session.

If you set environment variables by running a command file, you must build your applications in the same window in which you set the environment variables. If you build your applications in another window, you will not be using the same options you set in your first window.

When you install the DB2 AD Client, this statement is put into the CONFIG.SYS file:

   set LIB=%DB2PATH%\lib;%LIB%

The command files in this book assume that this statement is present. If you edit the CONFIG.SYS file after installing the DB2 AD Client, make sure this statement is not removed.

As well, these environment variables are automatically updated by DB2:

For the Java environment variables updated by DB2, see "OS/2".

In addition, if you are using one of the programming languages shown below, the CONFIG.SYS file must have the appropriate statement:

C/C++
set INCLUDE=%DB2PATH%\include;%INCLUDE%

FORTAN
set FINCLUDE=%DB2PATH%\include;%FINCLUDE%

IBM COBOL
set SYSLIB=%SYSLIB%;%DB2PATH%\include\cobol_a

Micro Focus COBOL
set COBCPY=%DB2PATH%\include\cobol_mf;%COBCPY%

On OS/2, no DB2 environment variables should be defined in CONFIG.SYS apart from DB2PATH and DB2INSTPROF. All DB2 variables should be defined in the DB2 Instance Profile Registry either at the global level, the instance level, or the instance node level (Parallel Edition). Use the db2set.exe command to set, modify, and list the variables.
Note:DB2INSTANCE is not required if you set the DB2INSTDEF registry variable. It defines the default instance name which is used if DB2INSTANCE is not set.


[ Top of Page | Previous Page | Next Page ]