Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

8.4.1 Executing UAPs that use an X/Open-based API (TX_function)

A UAP that uses an X/Open-based API (TX_function) uses a dedicated library. To compile and link edit such a UAP, the library dedicated to the TX_function and the library provided by HiRDB must be coupled.

Linux for AP8000 clients cannot execute UAPs that use an X/Open-based API (TX_ function).

Organization of this subsection
(1) Preprocessing a UAP that uses an X/Open-based API (TX_ function)
(2) Using OpenTP1
(3) Using TPBroker
(4) Using TUXEDO
(5) Using TP1/EE (limited to UNIX)

(1) Preprocessing a UAP that uses an X/Open-based API (TX_ function)

This item describes notes on executing a UAP in a HiRDB system that is linked with TP1/LiNK (transaction control).

Linking with TP1/LiNK is possible when both the HiRDB server and the HiRDB client are Windows versions.

(a) UAP preprocessing and linkage

If a UAP is to be executed in a TP1/LiNK environment, execute UAP preprocessing and linkage as described as follows.

During SQL preprocessor execution, specify one of the following options:

Command specification example for C
 
PDCPP SAMPLE /XA
 

Command specification example for COBOL
 
PDCBL SAMPLE.ECB /XAD
 

Link the following library to the UAP:

Do not link CLTDLL.LIB.

(2) Using OpenTP1

UAP compilation and linkage when OpenTP1 is used are explained here. For details about compilation and linkage using OpenTP1, see the OpenTP1 Programming Reference C Language manual or the OpenTP1 Programming Reference COBOL Language manual.

(a) C

When OpenTP1 is used to create a UAP that accesses HiRDB, it is necessary to create a transaction control object file with the OpenTP1 trnmkobj operation command; following is the specification:

trnmkobj -o control-object-filename -r HiRDB_DB_server

Example
  • The transaction control object filename is control.
trnmkobj -o control -r HiRDB_DB_server

The following is specified to compile and link a UAP that uses API.

To use a shared library:
/usr/bin/cc -c -l$DCDIR/include -I/HiRDB/include filename.c
  /usr/bin/cc -o UAP-executable-form-filename UAP-filename.o
  $DCDIR/spool/trnrmcmd/userobj/control-object-filename.o
  -L/HiRDB/client/lib -lzclty -L$DCDIR/lib -Wl,-B,immediate
  -Wl,-a, default -lbetran -L/usr/lib -ltactk -lbsd -lc

Notes
  1. The directory for installing HiRDB is underlined.
  2. The -W1, +s option must be specified if different HiRDB distribution library directories are used for UAP creation and for UAP execution. When different distribution library directories are used for linkage and for execution, the SHLIB_PATH environment variable must be used at the time of execution to set the directory containing the distribution library.
  3. Depending on the method of OLTP registration that is used, the HiRDB system provides the following four libraries for UAPs that use an X/Open-compatible API. The library name that is specified for the linkage must match the applicable OLTP registration method.
    -lzcltx (dynamic registration)
    -lzclty (static/dynamic registration)
    -lzcltxs (dynamic registration when the multi-connection facility is used)
    -lzcltys (static/dynamic registration when the multi-connection facility is used)
    In static/dynamic registration, the registration type can be switched to static registration or dynamic registration by the switch registered to TM. For details about the registration procedure, see the explanation of registering a HiRDB system in the transaction manager in the HiRDB Version 8 Installation and Design Guide.
  4. To create a UAP that uses an X/Open-compatible API in AIX 5L, specify -brtl in the linkage option.

Example
The filename (UAP name) is sample, UAP executable form filename is SAMPLE, and the transaction control object filename is control.
/usr/bin/cc -c -I$DCDIR/include -I/HiRDB/include sample.c
  /usr/bin/cc -o SAMPLE sample.o
  $DCDIR/spool/trnrmcmd/userobj/control.o
  -L/HiRDB/client/lib -lzclty -L$DCDIR/lib
  -Wl,-B,immediate -Wl,-a,default
  -lbetran -L/usr/lib -ltactk -lbsd -lc

To use an archive library:
/usr/bin/cc -c -l$DCDIR/include -I/HiRDB/include filename.c
  /usr/bin/cc -o UAP-executable-form-filename UAP-filename.o
  $DCDIR/spool/trnrmcmd/userobj/control-object-filename.o
  -L/HiRDB/client/lib -lcltxa -L$DCDIR/lib -Wl,-B,immediate
  -Wl,-a, default -lbetran -L/usr/lib -ltactk -lbsd -lc

Notes
  1. The directory for installing HiRDB is underlined.
  2. The archive library provided by HiRDB (-lcltxa) must be specified before the library provided by OpenTP1 (-lbetran).
  3. Depending on the method of OLTP registration that is used, the HiRDB system provides the following two libraries for UAPs that use an X/Open-compatible API. The library name that is specified for the linkage must match the applicable OLTP registration method.
    -lcltxa (dynamic registration)
    -lcltya (static/dynamic registration)
    In static/dynamic registration, the registration type can be switched to static registration or dynamic registration by the switch registered to TM. For details about the registration procedure, see the explanation of registering a HiRDB system in the transaction manager in the HiRDB Version 8 Installation and Design Guide.

Example
The filename (UAP name) is sample, UAP executable form filename is SAMPLE, and the transaction control object filename is control.
/usr/bin/cc -c -I$DCDIR/include -I/HiRDB/include sample.c
  /usr/bin/cc -o SAMPLE sample.o
  $DCDIR/spool/trnrmcmd/userobj/control.o
  -L/HiRDB/client/lib -lcltxa -L$DCDIR/lib
  -Wl,-B,immediate -Wl,-a,default
  -lbetran -L/usr/lib -ltactk -lbsd -lc
(b) COBOL

When OpenTP1 is used to create a UAP that accesses HiRDB, it is necessary to create a transaction control object file with the OpenTP1 trnmkobj operation command; following is the specification:

trnmkobj -o control-object-filename -r HiRDB_DB_SERVER

Example
  • The transaction control object filename is control.
trnmkobj -o control -r HiRDB_DB_SERVER

The following is specified to compile and link a UAP that uses API.

To use a shared library:
ccbl -o UAP-executable-form-filename -Mw filename.cbl
  $DCDIR/spool/trnrmcmd/userobj/control-object-filename.o
  -L/HiRDB/client/lib -lzclty -L$DCDIR/lib -Wl,-B,immediate
  -Wl,-a, default -lbetran -L/usr/lib -ltactk -lbsd -lc

Notes
  1. The directory for installing HiRDB is underlined.
  2. The -Wl, +s option must be specified if different HiRDB distribution library directories are used for UAP creation and for UAP execution. When different distribution library directories are used for linkage and for execution, the SHLIB_PATH environment variable must be used at the time of execution to set the directory containing the distribution library.
  3. Depending on the method of OLTP registration that is used, the HiRDB system provides the following two libraries for UAPs that use an X/Open-compatible API. The library name that is specified for the linkage must match the applicable OLTP registration method.
    -lzcltx (dynamic registration)
    -lzclty (static/dynamic registration)
    In static/dynamic registration, the registration type can be switched to static registration or dynamic registration by the switch registered to TM. For details about the registration procedure, see the explanation of registering a HiRDB system in the transaction manager in the HiRDB Version 8 Installation and Design Guide.

Example
The filename (UAP name) is sample, the UAP executable form filename is SAMPLE, and the transaction control object filename is control.
ccbl -o SAMPLE -Mw sample.cbl
  $DCDIR/spool/trnrmcmd/userobj/control.o
  -L/HiRDB/client/lib -lzclty -L$DCDIR/lib -Wl,-B,immediate
  -Wl,-a,default -lbetran -L/usr/lib -ltactk -lbsd -lc

To use an archive library:
ccbl -o UAP-executable-form-filename -Mw filename.cbl
  $DCDIR/spool/trnrmcmd/userobj/control-object-filename.o
  -L/HiRDB/client/lib -lcltxa -L$DCDIR/lib -Wl,-B,immediate
  -Wl,-a,default -lbetran -L/usr/lib -ltactk -lbsd -lc

Notes
  1. The directory for installing HiRDB is underlined.
  2. The archive library provided by HiRDB (-lcltxa) must be specified before the library provided by OpenTP1 (-lbetran).
  3. Depending on the method of OLTP registration that is used, the HiRDB system provides the following two libraries for UAPs that use an X/Open-compatible API. The library name that is specified for the linkage must match the applicable OLTP registration method.
    -lcltxa (dynamic registration)
    -lcltya (static/dynamic registration)
    In static/dynamic registration, the registration type can be switched to static registration or dynamic registration by the switch registered to TM. For details about the registration procedure, see the explanation of registering an HiRDB system in the transaction manager in the HiRDB Version 8 Installation and Design Guide.

Example
The filename (UAP name) is sample, the UAP executable form filename is SAMPLE, and the transaction control object filename is control.
ccbl -o SAMPLE -Mw sample.cbl
  $DCDIR/spool/trnrmcmd/userobj/control.o
  -L/HiRDB/client/lib -lcltxa -L$DCDIR/lib -Wl,-B,immediate
  -Wl,-a,default -lbetran -L/usr/lib -ltactk -lbsd -lc

(3) Using TPBroker

UAP compilation and linkage when TPBroker is used are explained here. The UAP is assumed to use the multi-thread XA interface. For details about compilation and linkage using TPBroker, see the TPBroker User's Guide manual. The libraries that are dedicated to the multi-thread XA interface support only C and C++.

(a) Transaction control object file creation

When TPBroker is used to create a UAP that accesses HiRDB, it is necessary to create a transaction control object file with the TPBroker tsmkobj operation command; following is the specification:

tsmkobj -o control-object-filename -r HiRDB_DB_SERVER
(b) Compilation and linkage

The following is specified to compile and link a UAP.

aCC +inst_implicit_include +DAportable -c -I$TPDIR/include
  -I$TPDIR/include/dispatch -I/HiRDB/include -D_REENTRANT
  -D_HP_UX_SOURCE -D_POSIX_C_SOURCE=199506Lfilename.c
aCC +inst_implicit_include +Daportable -o
  UAP-executable-form-filename UAP-filename.o
  $TPDIR/otsspool/XA/control-object-filename.o
  -L/HiRDB/client/lib -lzcltxk -L$TPDIR/lib -Wl,+s -lots_r
  -lorb-r
  -Wl,-B,immediate -Wl,-a,default -L/usr/lib -lpthread

Notes
  1. The directory for installing the HiRDB client is underlined.
  2. The -Wl, +s option must be specified if different HiRDB distribution library directories are used for UAP creation and for UAP execution. When different distribution library directories are used for linkage and for execution, the SHLIB_PATH environment variable must be used at the time of execution to set the directory containing the distribution library.
  3. Depending on the method of OLTP registration that is used (dynamic registration or static registration), the HiRDB system provides two libraries (-lzcltxk and -lzcltyk) for UAPs that use an XA interface that supports multiple threads. The library name that is specified for the linkage must match the applicable OLTP registration method.

(4) Using TUXEDO

UAP compilation and linkage when TUXEDO is used are explained here. The libraries that are dedicated to the XA interface support only C and C++.

(a) UNIX
(b) Windows

(5) Using TP1/EE (limited to UNIX)

UAP compilation and linkage when TP1/EE is used are explained here. For details about the TP1/EE commands, see the TP1/Server Base Enterprise Option User's Guide.

(a) C

Notes
  1. The directory for installing the HiRDB client is underlined.
  2. When the multi-thread XA interface is used, specify -lzcltyk as the library for the TP1/EE UAP, and specify a corresponding name as the library name to be specified during linkage. For details about the registration procedure, see the HiRDB Version 8 Installation and Design Guide.

Example
The name of the UAP executable file is SAMPLE, and the name of the object file for linking with the resource manager is control.
 
/usr/vac/bin/xlc_r -o SAMPLE $DCDIR/lib/ee_main.o control.o
     -brtl -bdynamic -L/HiRDB/lib -L/HiRDB/client/lib -L$DCDIR/lib
     -lpthread -lisode -lc_r -ldl -lzcltyk -lee -lee_rm -lbetran2 -ltactk
 
(b) COBOL