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

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

4.4 Examples

This section presents execution examples of HiRDB Dataextractor. Figure 4-6 shows the system configuration for the execution examples.

Figure 4-6 System configuration for execution examples

[Figure]

Organization of this section
(1) Environment for execution examples
(2) Execution examples

(1) Environment for execution examples

(a) Environment on the data source system (HOST1)

Table definition

Specification of environment variables
$PDDIR       /HiRDB1
$PDCONFPATH  /HiRDB1/conf
$PDUSER      "user01"/"user01"
$PDNAMEPORT  20000
$SHLIB_PATH  /HiRDB1/lib: /HiRDB1/client/lib
$PATH        /opt/HIRDBXT/bin
$LANG        ja_JP.SJIS
$XTHOST      HOST2
$XTPORTNO    20052

Specification in /etc/hosts at the importing host
        :
        :
160.16.150.120  HOST2
160.16.150.121  HOST3
        :
        :
(b) Environment on the data target system (HOST2)

Definition of port in /etc/services
                      :
                      :
hirdbxt1 20052/tcp    # HiRDB Dataextractor
hirdbxt2 50000/tcp    # HiRDB Dataextractor
                      :
                      :

Definition for HiRDB Dataextractor startup in /etc/inetd.conf
                      :
                      :
hirdbxt1 stream tcp nowait user01
/opt/HIRDBXT/bin/pxtcntl pxtcntl /usr/home/user01/xtenv1
hirdbxt2 stream tcp nowait user02
/opt/HIRDBXT/bin/pxtcntl pxtcntl /usr/home/user02/xtenv2
                      :
                      :

Specification of environment variables in the environment variable information specification file
(c) Environment on the file creation system (HOST3)

Definition of port in /etc/services
                     :
                     :
hirdbxt 20052/tcp    # HiRDB Dataextractor
                     :
                     :

Definition for HiRDB Dataextractor startup in /etc/inetd.conf
                     :
                     :
hirdbxt stream tcp nowait user01
/opt/HIRDBXT/bin/pxtcntl pxtcntl /usr/home/user01/xtenv
                     :
                     :

Specification of environment variables in the environment variable information specification file

(2) Execution examples

Specify the xtrep command on the data source system.

(a) Example 1

Copy table user01.T01 into table T01 at HOST2. Specify the following options:

Command specification
xtrep T01
(b) Example 2

Copy table user01.T01 into table T02 at HOST2. Specify the following options:

Command specification
xtrep -r T02 -d -l n -n 255 -m 100 -g -s /usr/home/user01/clm
-v /usr/home/user01/null -w /usr/home/user01/whr T01

Contents of /usr/home/user01/clm
C01,C02,C03,0

Contents of /usr/home/user01/whr
WHERE C01<='0000010000'

Contents of /usr/home/user01/null
C01=('FFFFFFFFFF')
(c) Example 3

Copy table user01.T03 into table T03 at HOST2. Specify the following options:

Command specification
xtrep -d -n 40 -p 50000 -e /tmp/xtrep_log
      -s /usr/home/user01/clm T03

Contents of /usr/home/user01/clm
ROW
(d) Example 4

Copy table user01.T03 to a file at HOST3. Specify the following options:

Command specification
xtrep -R dat -o T03 -h HOST3 T03
(e) Example 5

Copy table user01.T01 to a file at HOST3. Specify the following options:

Command specification
xtrep -R dat -o T01 -h HOST3 -m 50 -s /usr/home/user01/clm
-w /usr/home/user01/whr T01

Contents of /usr/home/user01/clm
C01,C02,C03,0

Contents of /usr/home/user01/whr
WHERE C01<='0000010000'
(f) Example 6

Copy table user01.T04 containing SGMLTEXT-type columns into table T04 at HOST2. Create a shell to execute the xtrep command.

Example of shell creation
  #!/bin/csh -f
  #-------------------------------------------------------------
  #Obtain max size of SGMLTEXT column
 
1. echo 'max(length(extracts(C03)))' > xt_clm
2. xtrep -R dat -o size -s xt_clm -h `hostname` T04
  rm -f xt_clm
 
  #-------------------------------------------------------------
  #Create xtrep parameters and command 
 
3. echo 'C01,C02,extracts(C03),C04' > xt_clm
 
  echo '#! /bin/csh -f'                              > xt_exec
4. echo 'setenv XTERRLEVEL 1'                        >> xt_exec
  echo 'setenv XTHOST HOST2'                         >> xt_exec
  echo 'setenv XTFILESIZE 10000000'                  >> xt_exec
5. echo 'setenv XTLOBBUFSIZE \c'                     >> xt_exec
  cat  /opt/HIRDBXT/spool/size | cut -c2-11          >> xt_exec
  echo 'xtrep -d -o xt_file1,xt_file2 -s xt_clm T04' >> xt_exec
  chmod 777 xt_exec
 
  #-------------------------------------------------------------
  #Execute xtrep
 
6. xt_exec
 
  rm -f /opt/HIRDBXT/spool/size
  rm -f xt_clm
  rm -f xt_exec

Explanation
  1. Creates column name specification file xt_clm to obtain the maximum length of the real data in the SGMLTEXT-type column (C03) in table user01.T04 that is subject to extraction.
  2. Executes the xtrep command with the xt_clm column name specification file created in 1 above specified, and outputs the maximum length of the real data in the SGMLTEXT-type column (C03) in table user01.T04 to /opt/HIRDBXT/spool/size at HOST1.
  3. Creates column name specification file xt_clm to extract data from table user01.T04.
  4. Outputs the environment variables and command line used by the xtrep command to xt_exec.
  5. Sets the maximum length of the real data output to /opt/HIRDBXT/spool/size in the XTLOBBUFSIZE environment variable.
  6. Executes the xtrep command with the xt_clm column name specification file created in 3 above specified, and imports table user01.T04 into table T04.