This section explains the procedure for creating an import information editing UOC routine with UNIX Datareplicator. If your import information editing UOC routine will use SQL statements, you cannot complete it directly. Instead, you must first convert it to the source format supported by the C compiler, and then compile it. The following figure shows the procedure up to the point where an import information editing UOC routine is executed.
Figure 8-3 Import information editing UOC routine's execution procedure
![[Figure]](FIGURE/RZ08S030.GIF)
The type of load module for an import information editing UOC routine that is created depends on the type of Datareplicator, as shown in the following table.
| Type of Datareplicator |
Type of load module for an import information editing UOC routine |
| 32-bit edition |
HP-UX edition
Solaris edition
AIX 5L edition
Linux edition |
32-bit edition#1 |
| 64-bit edition |
HP-UX edition
Solaris edition
AIX 5L edition |
32-bit edition#1 |
| IPF version |
HP-UX edition |
32-bit edition#1 |
| 64-bit edition#2 |
| Linux edition |
64-bit edition#2 |
- #1
- Code a UOC routine that runs in the 32-bit mode.
- #2
- Code a UOC routine that runs in the 64-bit mode. The following notes apply to this coding:
- Because the long type is recognized as an 8-byte integer, change the long type to the int type.
- A pointer has a length of eight bytes. There is no need to modify the pointer length unless the UOC routine contains processes in which the pointer length is important for processing.
- The functions used when an import information editing UOC routine is created might differ from those used in the 32-bit mode. Check if all functions are supported in the 64-bit mode.
- Because declaration of embedded variables using the long type is not supported, you must change long type embedded variables to the int type.
- Organization of this subsection
- (1) Creating the interface
- (2) Compiling and linking
The compiling and linking procedures are explained for each OS.
If an unresolved link error occurs, specify all libraries required during linking.
(a) In HP-UX
- Compilation of a 32-bit edition UOC routine in an environment for the IPF version
cc -c +DD32 -I /HiRDB/include -I /opt/hirdbds/include/32 UOC-source-file-name |
- Compilation of a 64-bit edition UOC routine in an environment for the IPF version
cc -c +DD64 -I /HiRDB/include -I /opt/hirdbds/include UOC-source-file-name |
- Compilation of a UOC routine in an environment for the 32-bit or 64-bit edition
cc -c -I /HiRDB/include -I /opt/hirdbds/include UOC-source-file-name |
- -c:
- Object creation option
- -I /HiRDB/include:
- For the underlined part, specify the target HiRDB installation directory.
- -I /opt/hirdbds/include:
- Directory that stores the header files provided by Datareplicator (always /opt/hirdbds/include). You can specify multiple directories if the UOC routine requires other header files.
- UOC-source-file-name:
- Name for the source file that will be obtained from the SQL preprocessor in a format supported by the C compiler
For details about the syntax of the compile command, see the applicable OS reference manual.
- Linkage of a 32-bit edition UOC routine in an environment for the IPF version
ld -o UOC-routine-name -u main UOC-routine-object-name
/opt/hirdbds/lib/32/libhdsuif.a /opt/hirdbds/lib/32/libhdsulb.so
/opt/hirdbds/lib/32/libhdscom.so /opt/hirdbds/lib/32/libhdspck.so -lc# |
- Linkage of a 64-bit edition UOC routine in an environment for the IPF version
ld -o UOC-routine-name -u main UOC-routine-object-name
/opt/hirdbds/lib/libhdsuif.a /opt/hirdbds/lib/libhdsulb.so
/opt/hirdbds/lib/libhdscom.so /opt/hirdbds/lib/libhdspck.so -lc# |
- Linkage of a UOC routine in an environment for the 32-bit or 64-bit edition
ld -o UOC-routine-name
-u main UOC-routine-object-name /opt/hirdbds/lib/libhdsuif.a
/opt/hirdbds/lib/libhdsulb.sl
/opt/hirdbds/lib/libhdscom.sl
/lib/crt0.o -lc# |
- Notes:
- Specify for UOC-routine-name a name for the executable file; specify this same filename in the import definition. Before executing the UOC routine, you must specify in the PATH environment variable the pathname of the directory containing the executable file. Specify for UOC-routine-object-name the name of the object file obtained from the compilation process. The libraries under /opt/hirdbds/lib are provided by the target Datareplicator; you must specify these libraries.
- The name of the executable file specified in the linkage command cannot begin with hds or duplicate any name reserved by any program already installed in the system.
- #
- To execute SQL statements from within the UOC routine, specify the following library at the end of the command:
Creating a 32-bit edition load module using the IPF version
+s -L HiRDB-installation-directory/client/lib -lzcltk
Creating a 64-bit edition load module using the IPF version
+s -L HiRDB-installation-directory/client/lib -lzcltk64
32-bit or 64-bit edition
+s -L HiRDB-installation-directory/client/lib -lzclt
+s means that the target HiRDB's installation directory is to be used separately from the target HiRDB directory; when you specify +s, also specify the SHLIB_PATH environment variable. -L indicates the default search path when SHLIB_PATH is omitted. -l specifies the target HiRDB's linkage library name.
(b) In Solaris
- UOC routine compilation
cc -c -I /HiRDB/include -I /opt/hirdbds/include UOC-source-file-name |
- -c:
- Object creation option
- -I /HiRDB/include:
- For the underlined part, specify the target HiRDB installation directory.
- -I /opt/hirdbds/include:
- Directory that stores the header files provided by Datareplicator (always /opt/hirdbds/include). You can specify multiple directories if the UOC routine requires other header files.
- UOC-source-file-name:
- Name for the source file that will be obtained from the SQL preprocessor in a format supported by the C compiler
/opt/SUNWspro/bin/cc -o UOC-routine-name -u main UOC-routine-object-name
/opt/hirdbds/lib/libhdsuif.a
/opt/hirdbds/lib/libhdscom.so
/opt/hirdbds/lib/libhdsulb.so
/opt/hirdbds/lib/libhdspck.so
-L/HiRDB/libl -R /HiRDB/lib -lzclt -lsocket -lnsl -lc -ldl
- Note 1:
- The -L option line contains the libraries that are used for executing SQL statements from within the UOC routine. For the underlined part, specify the target HiRDB installation directory.
- Note 2:
- You can omit the -R option. When you omit the -R option, you must add HiRDB-installation-directory/lib to LD_LIBRARY_PATH.
(c) In AIX
- UOC routine compilation
xlc -c -I /HiRDB/include -I /opt/hirdbds/include UOC-source-file-name |
- -c:
- Object creation option
- -I /HiRDB/include:
- For the underlined part, specify the target HiRDB installation directory.
- -I /opt/hirdbds/include:
- Directory that stores the header files provided by Datareplicator (always /opt/hirdbds/include). You can specify multiple directories if the UOC routine requires other header files.
- UOC-source-file-name:
- Name for the source file that will be obtained from the SQL preprocessor in a format supported by the C compiler
For details about the syntax of the compile command, see the applicable OS reference manual.
- UOC routine linkage
xlc -o UOC-routine-name -u main UOC-routine-object-name
/opt/hirdbds/lib/libhdspck.a /opt/hirdbds/lib/libhdsulb.a
/opt/hirdbds/lib/libhdscom.a
-L /HiRDB/client/lib -Wl,-blibpath:.:/usr/lib:/lib:/HiRDB/client/lib -lzclt
/opt/hirdbds/lib/libhdsuif.a -lm -lc |
- Note 1:
- For UOC-routine-name, specify the name of the executable file. Specify this executable file name in the import definition. For execution of the UOC routine, make sure that the path name of the directory containing the executable file has been set in the PATH environment variable.
- For the UOC routine object name, specify the name of the object file created by compilation.
- The libraries under /opt/hirdbds/lib are provided by the target Datareplicator. Make sure that these libraries are specified.
- Note 2:
- The executable file specified in the linkage command cannot have a name that begins with hds or that is prohibited by programs already installed in the system.
- Note 3:
- The -L option line contains the libraries that are used for executing SQL statements from within the UOC routine. For the underlined value, specify the directory in which the target HiRDB is installed.
(d) In Linux
- Compilation of a UOC routine in an environment for the 32-bit or IPF version
gcc -c -I /HiRDB/include -I /opt/hirdbds/include UOC-source-file-name |
- Compilation of a UOC routine in an environment for the EM64T version
gcc -c -m32 -I /HiRDB/include -I /opt/hirdbds/include UOC-source-file-name |
- -c:
- Object creation option
- -I /HiRDB/include:
- For the underlined part, specify the target HiRDB installation directory.
- -I /opt/hirdbds/include:
- Directory that stores the header files provided by Datareplicator (always /opt/hirdbds/include). You can specify multiple directories if the UOC routine requires other header files.
- UOC-source-file-name:
- Name for the source file that will be obtained from the SQL preprocessor in a format supported by the C compiler
For details about the syntax of the compile command, see the applicable OS reference manual.
- Linkage of a UOC routine in an environment for the 32-bit or IPF version
gcc -o UOC-routine-name -u main UOC-routine-object-name
/opt/hirdbds/lib/libhdsuif.a /opt/hirdbds/lib/libhdsulb.so
/opt/hirdbds/lib/libhdscom.so /opt/hirdbds/lib/libhdspck.so
-lpthread#1 -ldl
-L/HiRDB/client/lib -lzcltk64#2 -Wl,-R/HiRDB/client/lib |
- #1
- In the 32-bit edition, -lpthread is not required.
- #2
- In the 32-bit edition, replace -lzcltk64 with -lzclt.
- Linkage of a UOC routine in an environment for the EM64T version
gcc -o UOC-routine-name -m32 -u main UOC-routine-object-name
/opt/hirdbds/lib/libhdsuif.a /opt/hirdbds/lib/libhdsulb.so
/opt/hirdbds/lib/libhdscom.so /opt/hirdbds/lib/libhdspck.so
-lpthread -ldl
-L/HiRDB/client/lib -lzclt -Wl,-R/HiRDB/client/lib |
- Note 1:
- You can omit the -R option. When you omit the -R option, you must add HiRDB-installation-directory/lib to LD_LIBRARY_PATH.
- Note 2:
- -l specifies the target HiRDB's linkage library name.
- Note 3:
- The -L option line contains the libraries that are used for executing SQL statements from within the UOC routine. For the underlined part, specify the target HiRDB installation directory.
All rights reserved. Copyright (C) 2007, 2013, Hitachi, Ltd.