HiRDB Datareplicator Version 8 Description, User's Guide and Operator's Guide
You use C language to program a send data UOC routine. The source Datareplicator provides a function for use in creating a send data UOC routine. The following table shows the function that can be used by a send data UOC routine and provides an overview of the function.
Table 8-37 Overview of the function provided for creating a send data UOC routine
| Function name | Function |
|---|---|
| hds_usendcheck() (check send data) | Receives send data (update information) and stores the checking results. The user is responsible for specifying the information to be checked and returning the results. |
A send data UOC routine uses the hde_usendcheck() function. You can create one UOC function per source Datareplicator system.
#include<hde_usend.h>
int hde_usendcheck(
HDE_EXT_ENVINFO *envinfo, /* (IN) transmission environment */
/* information block */
HDE_EXT_TBLINFO *tblinfo, /* (IN) extraction table */
/* information block */
HDE_EXT_COLINFO *colinfo, /* (IN) extraction data */
/* information block */
int *status); /* (OUT) transmission UOC status */
The parameters are explained below. The function's structure is defined in the send data UOC routine's header file. Do not update an area whose structure is defined by the caller. For details about the header files, see Table 8-45 Header file for a send data UOC routine.
Table 8-38 Contents of HDE_EXT_ENVINFO
| Member name | Length (bytes) | Attribute | Area name | Defined by | Description |
|---|---|---|---|---|---|
| sendid | 9 | char | Target identifier | Caller | Identifier indicting the destination of the corresponding update information (ends with NULL) |
| hdeid | 1 | unsigned char | Source Datareplicator identifier | Caller | Value of the hdeid operand in the extraction system definition Two-character identifier is expressed as one byte.
|
| hdsid | 1 | unsigned char | Import system identifier | Caller | Value of the sendhdsid operand in the transmission environment definition Two-character identifier is expressed as one byte.
|
| dsid | 1 | unsigned char | Data linkage identifier | Caller | Value of the dsid operand in the transmission environment definition or the extraction environment definition (the dsid operand in the transmission environment definition takes precedence over the dsid operand in the extraction environment definition) Two-character identifier is expressed as one byte.
|
| reserve1 | 20 | char | Reserved | Caller | Reserved (0x00...00) |
Table 8-39 Contents of HDE_EXT_TBLINFO
| Member name | Length (bytes) | Attribute | Area name | Defined by | Description |
|---|---|---|---|---|---|
| tableid | 4 | long | Extraction table ID | Caller | Extraction table ID of the corresponding update information |
| tablename | 31 | char | Extraction table name | Caller | Extraction table name of the corresponding update information (ends with NULL) |
| schemaname | 9 | char | Authorization identifier | Caller | Authorization identifier for the extraction table of the corresponding update information (ends with NULL) |
| exttime | 8 | char | Extraction time | Caller | Extraction time of the corresponding update information Output in unsigned packed decimal format (2 characters per byte) (YYYYMMDDhhmmss00) |
| extkind | 1 | unsigned char | Update type | Caller | SQL type used for updating
|
| apkind | 1 | unsigned char | Loopback information | Caller | Loopback information
|
| reserve1 | 11 | char | Reserved | Caller | Reserved (0x00...00) |
Table 8-40 Contents of HDE_EXT_COLINFO
| Member name | Length (bytes) | Attribute | Area name | Defined by | Description |
|---|---|---|---|---|---|
| colnum | 4 | long | Number of column information items | Caller | Number of extraction columns in the corresponding update information (number of HDE_EXT_DATAINFO entries) |
| *datainfo | 4 | HDE_EXT_ DATAINFO * |
Start address of extraction data information | Caller | Start address of the array of extraction data information (HDE_EXT_DATAINFO) |
| reserve | 8 | char | Reserved | Caller | Reserved |
Table 8-41 Contents of HDE_EXT_DATAINFO
| Member name | Length (bytes) | Attribute | Area name | Defined by | Description |
|---|---|---|---|---|---|
| colid | 4 | long | Extraction column ID | Caller | Extraction column ID |
| colname | 31 | char | Extraction column name | Caller | Extraction column name (ends with NULL) |
| coltype | 1 | unsigned char | Column data type | Caller | Data type of the extraction column. For a list of column data types, see Table 8-43 Column data types. |
| colopt | 1 | unsigned char | Column option | Caller | Options for the extraction column
|
| charset | 1 | unsigned char | Character set type | Caller | Character set type for the corresponding column
|
| reserve1 | 2 | char | Reserved | Caller | Reserved (0x00...00) |
| bf_datalen | 4 | long | Column data length before updating#1 | Caller | Data length in the extraction column before updating
|
| bf_dataptr | 4 | union#2 | Column data before updating#1 | Caller | Start address of the column data in the extraction column before updating
|
| af_datalen | 4 | long | Column data length after updating#1 | Caller | Data length in the extraction column after updating
|
| af_dataptr | 4 | union#2 | Column data after updating#1 | Caller | Start address of the column data in the extraction column after updating
|
| precision | 2 | short | Precision | Caller | If coltype is HDE_T_DEC, the precision (total length) is set; otherwise, 0 is set. |
| scale | 2 | short | Scaling | Caller | If coltype is HDE_T_DEC, scaling (decimal places) is set; otherwise, 0 is set. |
| sec_preci | 2 | short | Decimal places for seconds | Caller | If coltype is HDE_T_TIMESTAMP, the decimal places for seconds is set; otherwise, 0 is set. |
| reserve2 | 8 | char | Reserved | Caller | Reserved (0x00...00) |
Table 8-42 Combination of data before and after update processing
| Data type | Data length before updating | Data before updating | Data length after updating | Data after updating | ||
|---|---|---|---|---|---|---|
| INSERT | n-byte data | -1 | -1 | n | addr | |
| 0-byte data | -1 | -1 | 0 | addr | ||
| NULL data | -1 | -1 | 0 | 0 | ||
| UPDATE for non-mapping key | From n-byte data | To n-byte data | -1 | -1 | n | addr |
| To 0-byte data | -1 | -1 | 0 | addr | ||
| To NULL data | -1 | -1 | 0 | 0 | ||
| From 0-byte data | To n-byte data | -1 | -1 | n | addr | |
| To 0-byte data | -1 | -1 | 0 | addr | ||
| To NULL data | -1 | -1 | 0 | 0 | ||
| From NULL data | To n-byte data | -1 | -1 | n | addr | |
| To 0-byte data | -1 | -1 | 0 | addr | ||
| To NULL data | -1 | -1 | 0 | 0 | ||
| UPDATE for mapping key | From n-byte data | To n-byte data | n | addr | n | addr |
| To 0-byte data | n | addr | 0 | addr | ||
| To NULL data | n | addr | 0 | 0 | ||
| From 0-byte data | To n-byte data | 0 | addr | n | addr | |
| To 0-byte data | 0 | addr | 0 | addr | ||
| To NULL data | 0 | addr | 0 | 0 | ||
| From NULL data | To n-byte data | 0 | 0 | n | addr | |
| To 0-byte data | 0 | 0 | 0 | addr | ||
| To NULL data | 0 | 0 | 0 | 0 | ||
| DELETE# | n-byte data | n | addr | -1 | -1 | |
| 0-byte data | 0 | addr | -1 | -1 | ||
| NULL data | 0 | 0 | -1 | -1 | ||
Table 8-43 Column data types
| Column data type | Mnemonic | Code |
|---|---|---|
| INTEGER | HDE_T_INT | 0xF1 |
| SMALLINT | HDE_T_SINT | 0xF5 |
| LARGE DECIMAL | HDE_T_DEC | 0xE5 |
| FLOAT | HDE_T_FLT | 0xE1 |
| DOUBLE PRECISION | HDE_T_DBL | 0xE1 |
| SMALL FLOAT | HDE_T_SFLT | 0xE3 |
| REAL | HDE_T_REAL | 0xE3 |
| CHARACTER | HDE_T_CHAR | 0xC5 |
| VARCHAR | HDE_T_VCHAR | 0xC1 |
| NCHAR | HDE_T_NCHAR | 0xB5 |
| NVARCHAR | HDE_T_NVCHAR | 0xB1 |
| MCHAR | HDE_T_MCHAR | 0xA5 |
| MVARCHAR | HDE_T_MVCHAR | 0xA1 |
| DATE | HDE_T_DATE | 0x71 |
| TIME | HDE_T_TIME | 0x79 |
| TIMESTAMP | HDE_T_TIMESTAMP | 0x7D |
| INTERVAL YEAR TO DAY | HDE_T_YTD | 0x65 |
| INTERVAL HOUR TO SECOND | HDE_T_HTS | 0x6F |
| ADT (abstract data type) | HDE_T_ADT | 0x83 |
| BLOB | HDE_T_BLOB | 0x93 |
| BINARY | HDE_T_BINARY | 0x91 |
Set the return value when the send data UOC routine returns control to the caller. The following table shows the return values that can be set by a send data UOC routine.
Table 8-44 Return values from hde_usendcheck()
| Status | Code | Mnemonic | Processing after control is returned |
|---|---|---|---|
| Update information is sent | 1 | HDE_EXT_SEND | Sends the corresponding update information to the target system. |
| Update information is not sent | 0 | HDE_EXT_NOSEND | Does not send the corresponding update information to the target system. |
| Transmission processing is terminated | -1 | HDE_EXT_STOP | Terminates transmission to the target system. When this value is returned, the transmission process outputs the KFRB02052-E error message and cancels processing for the corresponding destination. The reason for terminating transmission processing is set in the hde_usendcheck() function's status. |
| Other |
The header file used with a send data UOC routine is stored in the following directory:
UNIX Datareplicator: /opt/hirdbds/include/
Windows Datareplicator: Datareplicator-installation-directory\include\
The following table shows the header file for a send data UOC routine.
Table 8-45 Header file for a send data UOC routine
| Filename | Description | Members associated with the send data UOC routine |
|---|---|---|
| hde_usend.h | Structure and mnemonic codes for the send data UOC routine |
|
All rights reserved. Copyright (C) 2007, 2013, Hitachi, Ltd.