HiRDB Datareplicator Version 8 Description, User's Guide and Operator's Guide
You use C language to program a column data editing UOC routine. The target Datareplicator provides a function for use in creating your column data editing UOC routine. The following table shows the function that can be used for a column data editing UOC routine and provides an overview of the function.
Table 8-26 Overview of the function provided for creating a column data editing UOC routine
| Function name | Function |
|---|---|
| hds_ucoleditX() (Edit column data) | Receives column data to be edited and stores the data obtained after editing. The user is responsible for editing the data, and then storing the data obtained after editing. |
A column data editing UOC routine uses the hds_ucoleditX function (X: 1-8). You can create eight UOC functions per Datareplicator system.
#include<hds_ucommon.h>
#include<hds_ureflect.h>
int hds_ucoleditX(UCOLENV_BLK *column-data-editing-interface-environment-block,
UCOLUMN_BLK *pre-edit-import-column-information,
UCOLUMN_BLK *post-edit-import-column-information,
long *status);
The parameters are explained below. The function's structure is defined in the column data editing UOC routine's header files. Do not update an area whose structure is defined by the caller. For details about the header files, see Table 8-33 Header files for the column data editing UOC.
Table 8-27 Contents of UCOLENV_BLK
| Member name | Length (bytes) | Attribute | Area name | Defined by | Description |
|---|---|---|---|---|---|
| interface_blk | 56 | UINTERFACE_ BLK |
Interface block | Caller | Import system definition information |
| reflect_blk | 96 | UREFLECT_BLK | Import control block | Caller | Source database update information in import data |
| auth_id | 8 | char | Authorization identifier | Caller | Authorization identifier used for importing into the target database |
| tbl_id | 30 | char | Table identifier | Caller | Table identifier used for importing into the target database |
| reserve | 2 | char | Reserved | Caller | N/A |
Table 8-28 Contents of UINTERFACE_BLK
| Member name | Length (bytes) | Attribute | Area name | Defined by | Description |
|---|---|---|---|---|---|
| auth_id | 8 | char | Authorization identifier | Caller | Authorization identifier specified in the import system definition |
| password | 30 | char | Password | Caller | Password specified in the import system definition |
| exsysid | 2 | char | Source Datareplicator identifier | Caller | Source Datareplicator identifier specified in the source Datareplicator's extraction system definition, expressed as a string of lowercase hexadecimal characters. During data linkage with XDM/DS, 00 is set. |
| repid1 | 2 | char | Identifier 1 | Caller | Data linkage identifier specified in the import system definition |
| repid2 | 2 | char | Identifier 2 | Caller | Target Datareplicator identifier specified in the import system definition |
| *inherinf1 | 4 | char * | N/A | N/A | Not used with a column data editing UOC function. |
| inherinf2 | 4 | long | N/A | N/A | Not used with a column data editing UOC function. |
| stopinf | 4 | long | N/A | N/A | Not used with a column data editing UOC function. |
Table 8-29 Contents of UREFLECT_BLK
| Member name | Length (bytes) | Attribute | Area name | Defined by | Description |
|---|---|---|---|---|---|
| updkind | 8 | char | Update type | Caller | Type of update processing on the source database (as an 8-byte character string, as shown below; if the type is shorter than 8 bytes, spaces are added):
|
| auth_id | 30 | char | Authorization identifier | Caller | Authorization identifier used to update the source database |
| tbl_id | 30 | char | Table identifier | Caller | Table identifier used to update the source database |
| upd_date | 4 | char | Update date | Caller | Date the source database was updated (date the update information was output to the journal). The date is displayed in unsigned packed decimal format (YYYYMMDD). |
| upd_time | 4 | char | Update time | Caller | Time the source database was updated (time the update information was output to the journal). The time is displayed in unsigned packed decimal format (HHMMSSTT where TT is 1/100 sec.). |
| uapname | 8 | char | Source UAP name | Caller | Name of the user application program used to update the source database |
| extsysid | 4 | char | Source database's system ID | Caller |
|
| infflag1 | 1 | unsigned char | Flag 1 | Caller | Not used.
|
| infflag2 | 1 | unsigned char | Flag 2 | Caller | Not used.
|
| infflag3 | 1 | unsigned char | Flag 3 | Caller | Not used.
|
| reserve1 | 1 | char | N/A | N/A | (For boundary adjustment) |
| infflag4 | 4 | long | Flag 4 | Caller | Not used.
|
Table 8-30 Contents of UCOLUMN_BLK
| Member name | Length (bytes) | Attribute | Area name | Pre-edit Defined by | Post-edit Defined by | Description |
|---|---|---|---|---|---|---|
| colname | 30 | char | Column name | Caller | Caller |
|
| coltype | 1 | unsigned char | Column type | Caller | Caller | Source column's column data type is set as the pre-edit import column information. After editing, set the column data type as the post-edit import column information. Use the same mnemonic as the import information editing interface (BLOB, BINARY, UNPACK, and ADT (SGMLTEXT, FREEWORD, XML) data type cannot be specified for the post-edit import column information). |
| coloption | 1 | unsigned char | Column option | Caller | Caller | Source column's column option is set as the pre-edit import column information. After editing, set the column option as the post-edit import column information. The following options can be set:
|
| elementnum | 4 | union | Valid element number in array column | Caller | N/A | If an array is specified as the column option in the pre-edit import column information, the valid element number of the array column is set (this information cannot be set in the post-edit import column information). |
| mltcolkind | 1 | unsigned char | N/A | N/A | N/A | Not used with a column data editing UOC routine. |
| adtfunc | 1 | unsigned char | ADT column import method | Caller | N/A | One of the following values is set as the abstract data type linkage method:
|
| charset | 1 | char | Character set type | Caller | N/A | Character set type of the column data that is to be passed to the UOC routine Do not change the character set type before or after editing. If the character set type is changed, Datareplicator ignores the edited character set type and resumes processing using the character set in effect before editing.
|
| reserve1 | 1 | char | N/A | N/A | N/A | (For boundary adjustment) |
| collen | 4 | long | Column data length | Caller | Caller | Column data length. For details, see Table 8-31 Specification rules for the column data length. If the column option is null data, 0 is set in the pre-edit import column information. If null data is set as the column option in the post-edit import column information, there is no need to set the column data length, regardless of the data type. |
| dataptr | 4 | union | Data address | Caller | N/A |
|
| dataptr | 4 | union | Data address | Caller | N/A |
|
Table 8-31 Specification rules for the column data length
| Before/after conversion Column data type |
Pre-edit import column information | Post-edit import column information | Remarks | ||
|---|---|---|---|---|---|
| Specified | Specified information | Required | Specified information | ||
| NCHAR | Yes | Pre-edit data length [characters] | Yes | Post-edit data length [characters] | N/A |
| CHAR MCHAR UNPACK |
Yes | Pre-edit data length [bytes] | Yes | Post-edit data length [bytes] | UNPACK type is not permitted for the post-edit import column data. |
| NVARCHAR VARCHAR MVARCHAR |
No | N/A | No | N/A | Edit the pre-edit data using the real length stored in the first 2 bytes of the data area. For the post-edit data, set its real length in the first 2 bytes of the data area. If the column data type is NVARCHAR, set the length in characters; if it is VARCHAR or MVARCHAR, set the length in bytes. |
| DECIMAL | Yes |
|
Yes |
|
The maximum precision is 38 in the following cases:
|
| TIMESTAMP | Yes |
|
Yes |
|
p is a numeric value indicating the scaling (decimal places). |
| Other | No | N/A | No | N/A | For the data length, see the HiRDB data format. |
You can set a status value in the event the column data editing UOC routine returns control with an error. The specified status value will be displayed in the error message when control is returned to Datareplicator.
Set the return value when control is returned to the caller. The following table shows the return values that can be set by a column data editing UOC routine.
Table 8-32 Return values from hds_ucoleditX()
| Status | Code | Mnemonic | Processing after control is returned |
|---|---|---|---|
| Normal termination | 0 | HDS_RET_NORM | Resumes processing. |
| Error detected (unresumable level) | Other than 0 | HDS_RET_ERR | Outputs a message at the caller, and then cancels import processing. |
The header files used with a column data editing UOC routine are stored in the following directory:
UNIX Datareplicator: /opt/hirdbds/include/
Windows Datareplicator: Datareplicator-installation-directory\include\
The following table lists and describes the header files for a column data editing UOC routine.
Table 8-33 Header files for the column data editing UOC
| Filename | Description | Members associated with the column data editing UOC routine |
|---|---|---|
| hds_ucommon.h | Structures and mnemonic codes common to column data editing UOC routines |
|
| hds_ureflect.h | Structure and mnemonics for the column data editing UOC routine |
|
All rights reserved. Copyright (C) 2007, 2013, Hitachi, Ltd.