Compiling and linking
The following sample commands use the symbol <DB2TOP>. <DB2TOP> represents the installation directory for the DB2 product.
- On AIX the directory path is:
/usr/lpp/db2_05_00- On HP-UX and Solaris the directory path is:
/opt/IBMdb2/V5.0- On Windows systems the directory path depends on the path chosen when installing the product. If you chose the default settings the path is:
c:\sqllib
Before issuing the link command on Windows systems, ensure that the LIB environment variable contains paths to the DB2 and WebSphere MQ libraries.
Copy the following files into a temporary directory:
- The amqsxag0.c file from your WebSphere MQ installation
This file can be found in the following directories:
- On UNIX:
<MQMTOP>/samp/xatm- On Windows systems:
<MQMTOP>\tools\c\samples\xatm
- The .c files that you have obtained by precompiling the .sqc source files, amqsxas0.sqc, amqsxaf0.sqc, and amqsxab0.sqc
- The files util.c and util.h from your DB2 installation.
These files can be found in the directory:
<DB2TOP>/samples/c
Build the object files for each .c file using the following compiler command for the platform that you are using:
- AIX
xlc_r -I<MQMTOP>/inc -I<DB2TOP>/include -c -o <FILENAME>.o <FILENAME>.c- HP-UX
cc -Aa +z -I<MQMTOP>/inc -I<DB2TOP>/include -c -o <FILENAME>.o <FILENAME>.c- Solaris
cc -Aa -KPIC -mt -I<MQMTOP>/inc -I<DB2TOP>/include -c -o <FILENAME>.o <FILENAME>.c- Windows systems
cl /c /I<MQMTOP>\tools\c\include /I<DB2TOP>\include <FILENAME>.c
Build the amqsxag0 executable using the following link command for the platform that you are using:
- AIX
xlc_r -H512 -T512 -L<DB2TOP>/lib -ldb2 -L<MQMTOP>/lib -lmqm util.o amqsxaf0.o amqsxab0.o amqsxag0.o -o amqsxag0- HP-UX Revision 11i
ld -E -L<DB2TOP>/lib -ldb2 -L<MQMTOP>/lib -lmqm -lc -lpthread -lcl /lib/crt0.o util.o amqsxaf0.o amqsxab0.o amqsxag0.o -o amqsxag0- Solaris
cc -mt -L<DB2TOP>/lib -ldb2 -L<MQMTOP>/lib -lmqm -lmqmzse-lmqmcs -lthread -lsocket -lc -lnsl -ldl util.o amqsxaf0.o amqsxab0.o amqsxag0.o -o amqsxag0- Windows systems
link util.obj amqsxaf0.obj amqsxab0.obj amqsxag0.obj mqm.lib db2api.lib /out:amqsxag0.exe
Build the amqsxas0 executable using the following compile and link commands for the platform that you are using:
- AIX
xlc_r -H512 -T512 -L<DB2TOP>/lib -ldb2 -L<MQMTOP>/lib -lmqm util.o amqsxas0.o -o amqsxas0- HP-UX Revision 11i
ld -E -L<DB2TOP>/lib -ldb2 -L<MQMTOP>/lib -lmqm -lc -lpthread -lcl /lib/crt0.o util.o amqsxas0.o -o amqsxas0- Solaris
cc -mt -L<DB2TOP>/lib -ldb2-L<MQMTOP>/lib -lqm -lmqmzse -lmqmcs -lthread -lsocket -lc -lnsl -ldl util.o amqsxas0.o -o amqsxas0- Windows systems
link util.obj amqsxas0.obj mqm.lib db2api.lib /out:amqsxas0.exeAdditional information
If you are working on AIX or HP-UX and want to access Oracle, use the xlc_r compiler and link to libmqm_r.a.
Parent topic:
Precompiling, compiling, and linking the samples
fg17760_