Example 1
The following example defines a transfer, NH_EMPLOYEES, that
creates an extraction database. The transfer definition selects
New Hampshire employees' address records for transfer to the
remote node.
RDO> INVOKE DATABASE FILENAME PERSONNEL
RDO> DEFINE TRANSFER NH_EMPLOYEES EXTRACTION
cont> DESCRIPTION IS /* Employees who live in New Hampshire */
cont> TO NODE1::DISK1:[ADAMS]NH_EMP
cont> MOVE RELATION E IN EMPLOYEES WITH E.STATE = "NH"
cont> SELECT FIELDS E.EMPLOYEE_ID,
cont> E.LAST_NAME,
cont> E.FIRST_NAME,
cont> E.MIDDLE_INITIAL,
cont> E.ADDRESS_DATA_1,
cont> E.ADDRESS_DATA_2,
cont> E.CITY,
cont> E.STATE,
cont> E.POSTAL_CODE
cont> LOG IS NH_EMPLOYEES.LOG
cont> END.
Example 2
This example shows an extraction from a remote source database to
a local target database. The DEFINE TRANSFER statement specifies
the transfer of all personnel records to the target node.
RDO> INVOKE DATABASE FILENAME NODE1::DISK1:[DIR1]PERSONNEL
RDO> DEFINE TRANSFER PERS_EXAMP EXTRACTION
cont> DESCRIPTION IS /* Extraction of personnel records*/
cont> TO [LEARNER.PERS]PERS_COPY
cont> MOVE RELATIONS ALL
cont> LOG IS [LEARNER.PERS]PERS_EXAMP.LOG
cont> END.
Example 3
This example shows an extraction transfer from a remote source
to a remote target database. The log file, PERS_EXAMP.LOG, is
located on the source node.
RDO> INVOKE DATABASE FILENAME NODE1::DISK1:[DIR1]PERSONNEL
RDO> DEFINE TRANSFER PERS_EXAMP EXTRACTION
cont> DESCRIPTION IS /* Extraction of personnel records*/
cont> TO NODE2::DISK2:[PROTO]PERS_TARGET
cont> MOVE RELATIONS ALL
cont> LOG IS PERS_EXAMP.LOG
cont> END.
Example 4
This example of a replication transfer definition sends the
entire colleges relation and the entire degrees relation to the
target database. The replication database can be accessed for
information about employees' college and degree histories. The
transfer definition includes some database parameters for the
target database.
RDO> INVOKE DATABASE FILENAME PERSONNEL
RDO> DEFINE TRANSFER COLLEGE_INFO REPLICATION
cont> DESCRIPTION IS /* Info about employees' colleges only */
cont> TO NODE1::DISK1:[BURTON]EMP_COLLEGE
cont> NUMBER OF USERS IS 25
cont> SNAPSHOT ALLOCATION IS 150 PAGES
cont> MOVE RELATION C IN COLLEGES
cont> SELECT FIELDS ALL;
cont> MOVE RELATION D IN DEGREES
cont> SELECT FIELDS ALL
cont> LOG IS COLLEGE_INFO.LOG
cont> END.
Example 5
This replication transfer specifies three fields from the CREDIT_
CARDS source database for transfer to the target database. The
fields are CARD_NUM, EXPIRATION_DATE, and VALID. Only invalid
credit card records are selected for the transfer.
RDO> DEFINE TRANSFER BAD_CARDS REPLICATION
cont> DESCRIPTION IS /* Invalid credit cards */
cont> TO NODE1::DISK1:[CREDIT]BAD_CARDS
cont> MOVE RELATION C IN CARDS WITH C.VALID = "N"
cont> SELECT FIELDS C.CARD_NUM,
cont> C.EXPIRATION_DATE,
cont> C.VALID
cont> LOG IS BAD_CARDS.LOG
cont> END.
Example 6
The following example defines a replication transfer that sends
the entire EMPLOYEES, JOB_HISTORY, SALARY_HISTORY, DEPARTMENTS,
and JOBS relations. The definition also selects three views for
transfer: CURRENT_INFO, CURRENT_JOB, and CURRENT_SALARY.
RDO> INVOKE DATABASE FILENAME PERSONNEL
RDO> DEFINE TRANSFER NH_PERSONNEL REPLICATION
cont> TO NODE1::DISK1:[DBADMIN]NHP.RDB
cont> MOVE RELATION E IN EMPLOYEES SELECT FIELDS ALL;
cont> MOVE RELATION JH IN JOB_HISTORY SELECT FIELDS ALL;
cont> MOVE RELATION SH IN SALARY_HISTORY SELECT FIELDS ALL;
cont> MOVE RELATION D IN DEPARTMENTS SELECT FIELDS ALL;
cont> MOVE RELATION J IN JOBS SELECT FIELDS ALL
cont> MOVE VIEWS CURRENT_INFO, CURRENT_JOB, CURRENT_SALARY
cont> LOG FILE IS DISK1:[DBADMIN]NHP.LOG
cont> END.
Example 7
The following example moves the CURRENT_JOB view defined in the
source database as a CROSS of the EMPLOYEES relation and the JOB_
HISTORY relation. You can achieve the effect of a CROSS clause
by transferring a view that is a CROSS in the source database. On
the target database, the records selected by the view are created
as a relation.
RDO> INVOKE DATABASE FILENAME PERSONNEL
RDO> DEFINE TRANSFER CJOB EXTRACTION
cont> TO NODE1::DISK1:[RAMESH]JOB_DB
cont> MOVE RELATION C IN CURRENT_JOB WITH C.JOB_CODE = "SEII"
cont> SELECT FIELDS C.LAST_NAME, C.FIRST_NAME, C.ADDRESS
cont> LOG FILE IS CJOB.LOG
cont> END TRANSFER.
Example 8
The following example shows an extraction rollup transfer that
invokes several source databases: PERSONNEL, WORKERS, and STAFF.
The transfer selects fields in the EMPLOYEES relations from the
three databases identified by the database handles DB1, DB2, and
DB3 and located on three different nodes and in the JOBS relation
from DB1. Then the transfer moves these relations to a single
target database, LOCAL_DB.
RDO> INVOKE DATABASE DB1=FILENAME "NODE1::DISK1:[DIR1]PERSONNEL"
RDO> INVOKE DATABASE DB2=FILENAME "NODE2::DISK2:[DIR2]WORKERS"
RDO> INVOKE DATABASE DB3=FILENAME "NODE3::DISK3:[DIR1]STAFF"
RDO> DEFINE TRANSFER LABOR EXTRACTION ROLLUP
cont> TO NODE4::DISK4:[DIR4]LOCAL_DB
cont> MOVE RELATION E IN DB1.EMPLOYEES WITH E.EMP_CODE= "A+"
cont> INTO RELATION EXEMPT_EMPLOYEES
cont> SELECT FIELDS E.EMP.ID,E.SALARY,E.JOB_CODE;
cont> MOVE RELATION E IN DB2.EMPLOYEES WITH E.EMP_CODE= "A+"
cont> INTO RELATION EXEMPT_EMPLOYEES
cont> SELECT FIELDS E.EMP_ID,E.SALARY,E.JOB_CODE;
cont> MOVE RELATION E IN DB3.EMPLOYEES WITH E.EMP_CODE= "A+"
cont> INTO RELATION EXEMPT_EMPLOYEES
cont> SELECT FIELDS E.EMP.ID,E.SALARY,E.JOB_CODE;
cont> MOVE RELATION J IN DB1.JOBS WITH J.JOB_CODE= "J17"
cont> INTO RELATION ENTRY_JOBS
cont> SELECT FIELDS J.JOB_NAME,J.JOB_CODE
cont> LOG FILE IS DISK4:[DIR4]LOCAL.LOG
cont> END.
Example 9
The following EMPLOYEES transfer creates an extraction database.
The transfer selects records using a first-clause, with-clause,
reduce-clause, and sort-clause.
RDO> INVOKE DATABASE FILENAME PERSONNEL
RDO> DEFINE TRANSFER EMPLOYEES EXTRACTION
cont> TO NODE1::DISK1:[NELSON]EMPLOYEES_INFO
cont> MOVE RELATION FIRST 10 E IN EMPLOYEES
cont> WITH E.CITY = "BOSTON"
cont> REDUCED TO E.LAST_NAME, E.FIRST_NAME, E.ADDRESS
cont> SORTED BY DESCENDING E.LAST_NAME
cont> SELECT FIELDS E.LAST_NAME, E.FIRST_NAME, E.ADDRESS
cont> LOG FILE IS DISK1:[NELSON]EMPLOYEES.LOG
cont> END TRANSFER.
Example 10
The following extraction transfer includes two command files.
The prologue command procedure establishes a connection to a
remote node, and the epilogue command procedure terminates the
connection. This example shows how to specify the prologue file
and epilogue file; it does not show the command procedures.
RDO> INVOKE DATABASE FILENAME NODE1::DISK1:[DBADMIN.PERS]PERSONNEL
RDO> DEFINE TRANSFER PERS_SAMPLE EXTRACTION
cont> TO PERS_COPY
cont> MOVE RELATIONS ALL
cont> PROLOGUE FILE IS DIALUP.COM
cont> EPILOGUE FILE IS HANGUP.COM
cont> LOG IS PERS_SAMPLE.LOG
cont> END.