HiRDB Datareplicator Version 8 Description, User's Guide and Operator's Guide
This section explains the sample UOC routine that is stored in the target Datareplicator.
When you install the target Datareplicator, the sample file is stored in the following directory:
The following figure shows the structure of the sample table that is subject to extraction processing.
Figure 8-7 Structure of the sample table subject to extraction processing
This sample executes the following extraction processing:
The following figure shows the structure of the sample table that is subject to import processing. The name of the target table is STOCK.
Figure 8-8 Structure of the target table (STOCK)
The import definition is shown below. This import definition is based on the following conditions:
format STOCK NAME PCODE /* product code */ NAME PNAME /* product name */ NAME COLOR /* color */ NAME PRICE /* price */ NAME SQTY /* stock quantity */ load PCODE,PNAME,PRICE,SQTY from STOCK by '/users/replicator/sampleuoc';
The editing start instruction function (hds_ubegin) executes CONNECT processing on the target HiRDB. The editing and processing instruction function (hds_uedit) executes INSERT, UPDATE, DELETE, PURGE, and COMMIT, as appropriate to the update type.
If UPDATE or DELETE results in an error (SQLCODE 100) because there is no row subject to update processing in the target table, the UOC routine ignores the erroneous update information and continues import processing. If any other SQL execution error occurs, the UOC routine executes ROLLBACK processing using the editing termination instruction function (hds_uend). The editing termination instruction function (hds_uend) executes ROLLBACK as required, and then executes DISCONNECT.
The editing start instruction function (hds_ubegin) sets the authorization identifier and password from its UINTERFACE_BLK parameters into the embedded variables and issues CONNECT to the target HiRDB using these embedded variables as parameters.
The editing and processing instruction function (hds_uedit) issues the SQL statement specified for the update type in its UREFLECT_BLK parameter to the target HiRDB.
This function determines the return code and status code on the basis of the SQLCODE SQL execution result. The following figure shows the return codes and status codes based on the SQLCODEs.
Table 8-23 Return codes and status codes based on the SQL codes
| SQLCODE | SQL status | Return code | Status code |
|---|---|---|---|
| 0 | Normal termination | HDS_RET_NORM (normal termination) | N/A |
| 100 | Error indicating that the specified row was not found in the target table during UPDATE or DELETE processing | HDS_RET_WARN (minor error) | SQLCODE |
| Other# | Error resulting in cancellation of import processing | HDS_RET_ERR (serious error) | SQLCODE |
#: The function sets -1 in inherited information 2 in the interface block (UINTERFACE_BLK), which is the hds_uedit function's parameter, as the flag for execution of ROLLBACK.
The editing termination instruction function (hds_uend) executes ROLLBACK and DISCONNECT. It executes ROLLBACK only when inherited information 2 is -1 in the interface block (UINTERFACE_BLK), which is the hds_uend function's parameter.
All rights reserved. Copyright (C) 2007, 2013, Hitachi, Ltd.