HiRDB Datareplicator Version 8 Description, User's Guide and Operator's Guide

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

8.3.4 Syntax for the function used with a send data UOC routine

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.
Organization of this subsection
(1) hds_usendcheck (check send data)
(2) Header file used with a send data UOC routine

(1) hds_usendcheck (check send data)

A send data UOC routine uses the hde_usendcheck() function. You can create one UOC function per source Datareplicator system.

(a) Function format
#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 */
(b) Explanation of the parameters

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.

HDE_EXT_ENVINFO
This block stores environment information for the send data UOC routine. The following table shows the contents of HDE_EXT_ENVINFO.

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.

Example:
C1 [Figure] 0xC1
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.

Example:
C1 [Figure] 0xC
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.

Example:
C1 [Figure] 0xC1
reserve1 20 char Reserved Caller Reserved (0x00...00)

HDE_EXT_TBLINFO
The following table shows the contents of HDE_EXT_TBLINFO.

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

INSERT:
HDE_EXT_INSERT (0x01)

UPDATE:
HDE_EXT_UPDATE (0x02)

DELETE:
HDE_EXT_DELETE (0x03)

PURGE:
HDE_EXT_PURGE (0x04)
apkind 1 unsigned char Loopback information Caller Loopback information

0x00:
Update information from UAP

0x01:
Update information from the target Datareplicator (hdesqle operand)
reserve1 11 char Reserved Caller Reserved (0x00...00)

HDE_EXT_COLINFO
Table 8-40 Contents of HDE_EXT_COLINFO shows the contents of HDE_EXT_COLINFO, and Table 8-41 Contents of HDE_EXT_DATAINFO shows the contents of HDE_EXT_DATAINFO that can be referenced from HDE_EXT_COLINFO. If the value of extkind in HDE_EXT_TBLINFO is HDE_EXT_PURGE, the contents of HDE_EXT_COLINFO are the null value and cannot be referenced.

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

Mapping key:
HDE_EXT_MAPPINGKEY (0x01)

Repetition column:
HDE_EXT_MCOL (0x02)
charset 1 unsigned char Character set type Caller Character set type for the corresponding column

When no character set is specified:
HDE_CSET_DEFAULT 0x00

When a character set (EBCDIK) is specified:
HDE_CSET_EBCDIK 0x01
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

0:
Indicates 0-byte data or the null value.

-1:
Indicates that the pre-update column data is not used.
bf_dataptr 4 union#2 Column data before updating#1 Caller Start address of the column data in the extraction column before updating

0:
Indicates the null value.

-1:
Indicates that the pre-update column data is not used.
af_datalen 4 long Column data length after updating#1 Caller Data length in the extraction column after updating

0:
Indicates 0-byte data or the null value.

-1:
Indicates that the post-update column data is not used.
af_dataptr 4 union#2 Column data after updating#1 Caller Start address of the column data in the extraction column after updating

0:
Indicates the null value.

-1:
Indicates that the post-update column data is not used.
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)

#1
Table 8-42 Combination of data before and after update processing shows the combinations of data before and after update processing. In the case of INSERT, DATAINFO (array) is sorted by the column ID; in the case of UPDATE or DELETE, it is sorted in the order extracted.

#2
If the corresponding extraction column has the CHAR or VARCHAR attribute, the character set of the corresponding extraction column is used for the data to be passed.

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

#
Only the mapping key data is passed. In the case of same-value updating on variable-length data or non-updating, all data information before and after updating is -1.
The following table lists the column data types.

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

int *status
Indicates the UOC routine's status. This parameter is used to display the status in the event an error occurs within the UOC routine. When the function is called, this parameter is initialized to 0, and then passed back to the calling function.
The status code is embedded in the KFRB02052-E error message, which is output when the return value is neither HDE_EXT_SEND(1) nor HDE_EXT_NOSEND(0). This embedded value has no effect on the transmission process's action.
(c) Return value

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

(2) Header file used with a send data UOC routine

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
  • HDE_EXT_ENVINFO
  • HDE_EXT_TBLINFO
  • HDE_EXT_COLINFO
  • HDE_EXT_DATAINFO
  • Mnemonics for the data type
  • Mnemonics for the data address