VMS Help  —  RMU72  Load  Database  Examples (Cont.)
    Example 15

    The following example assumes you want to load a data file
    into the JOBS table that contains more fields than the table
    definition in the mf_personnel database. The example first
    attempts to do this by just excluding the extra field from the
    list associated with the Fields qualifier. However, this causes
    an error to be returned. The example then uses the FILLER keyword
    in the .rrd file to tell Oracle RMU not to attempt to load the
    additional field. The command executes successfully.

    The table definition for the JOBS table is as follows:

    Columns for table JOBS:
    Column Name                     Data Type        Domain
    -----------                     ---------        ------
    JOB_CODE                        CHAR(4)          JOB_CODE_DOM
     Primary Key constraint JOBS_PRIMARY_JOB_CODE
    WAGE_CLASS                      CHAR(1)          WAGE_CLASS_DOM
    JOB_TITLE                       CHAR(20)         JOB_TITLE_DOM
    MINIMUM_SALARY                  INTEGER(2)       SALARY_DOM
    MAXIMUM_SALARY                  INTEGER(2)       SALARY_DOM

    The .rrd file for the data you want to load appears as follows
    (note that there is no corresponding field to JOB_STATUS in the
    mf_personnel database definition for the JOBS table):

    DEFINE FIELD JOB_CODE DATATYPE IS TEXT SIZE IS 4.
    DEFINE FIELD WAGE_CLASS DATATYPE IS TEXT SIZE IS 1.
    DEFINE FIELD JOB_TITLE DATATYPE IS TEXT SIZE IS 20.
    DEFINE FIELD MINIMUM_SALARY DATATYPE IS TEXT SIZE IS 13.
    DEFINE FIELD MAXIMUM_SALARY DATATYPE IS TEXT SIZE IS 13.
    DEFINE FIELD JOB_STATUS DATATYPE IS TEXT SIZE IS 4.
    DEFINE RECORD JOBS.
       JOB_CODE .
       WAGE_CLASS .
       JOB_TITLE .
       MINIMUM_SALARY .
       MAXIMUM_SALARY .
       JOB_STATUS .
    END JOBS RECORD.

    The data file you want to load, jobs.unl, appears as follows:

    DBAD4Corp Db Administratr55000.00     95000.00     Old

    You attempt to load the file in the mf_personnel database
    by listing only the fields in the RMU Load command that have
    corresponding fields defined in the database:

    $ RMU/LOAD MF_PERSONNEL/RMS=(FILE=JOBS.RRD, FORMAT=TEXT) -
    _$ /FIELDS=(JOB_CODE, WAGE_CLASS, JOB_TITLE, MINIMUM_SALARY, -
    _$ MAXIMUM_SALARY) JOBS JOBS.UNL
    %RMU-F-FLDMUSMAT, Specified fields must match in number and datatype
    with the unloaded data
    %RMU-I-DATRECSTO, 0 data records stored

    The workaround for the problem of a mismatch between your data
    and .rrd file, and database definition for a table is to use the
    FILLER keyword in your .rrd file, as follows:

    DEFINE FIELD JOB_CODE DATATYPE IS TEXT SIZE IS 4.
    DEFINE FIELD WAGE_CLASS DATATYPE IS TEXT SIZE IS 1.
    DEFINE FIELD JOB_TITLE DATATYPE IS TEXT SIZE IS 20.
    DEFINE FIELD MINIMUM_SALARY DATATYPE IS TEXT SIZE IS 13.
    DEFINE FIELD MAXIMUM_SALARY DATATYPE IS TEXT SIZE IS 13.
    DEFINE FIELD JOB_STATUS DATATYPE IS TEXT SIZE IS 4 FILLER.  <------
    DEFINE RECORD JOBS.
       JOB_CODE .
       WAGE_CLASS .
       JOB_TITLE .
       MINIMUM_SALARY .
       MAXIMUM_SALARY .
       JOB_STATUS .
    END JOBS RECORD.

    Now that the .rrd file has been modified, attempt to load the
    record again:

    $ RMU/LOAD MF_PERSONNEL/RMS=(FILE=JOBS.RRD, FORMAT=TEXT) -
    _$ /FIELDS=(JOB_CODE, WAGE_CLASS, JOB_TITLE, MINIMUM_SALARY, -
    _$ MAXIMUM_SALARY) JOBS JOBS.UNL
    %RMU-I-DATRECSTO, 1 data records stored.

    Example 16

    The following example demonstrates the use of the Null="*" option
    of the Record_Definition qualifier to signal to Oracle RMU that
    any data that appears as an unquoted asterisk in the .unl file
    should have the corresponding column in the database be flagged
    as NULL.

    The example shows the contents of the .unl file, followed by the
    RMU Load command used to load this .unl file, and then the output
    from an SQL statement to display the data loaded.

    "98888","ABUSHAKRA","CAROLINE",*,"5 CIRCLE STREET","BOX 506",
    "CHELMSFORD", "MA", "02184", "1960061400000000"#
    "98889","BRADFORD","LEO",*,"4 PLACE STREET","BOX 555", "NASHUA","NH",
    "03060", "1949051800000000"#

    $ RMU/LOAD/FIELDS=(EMPLOYEE_ID, LAST_NAME, FIRST_NAME, -
    _$ MIDDLE_INITIAL, ADDRESS_DATA_1, ADDRESS_DATA_2,  -
    _$ CITY, STATE, POSTAL_CODE, BIRTHDAY) -
    _$ /RECORD_DEFINITION=(FILE= EMPLOYEES.RRD, -
    _$ FORMAT=DELIMITED_TEXT, -
    _$ TERMINATOR="#", -
    -$ NULL="*" ) -
    _$ MF_PERSONNEL EMPLOYEES EMPLOYEES.UNL
    %RMU-I-DATRECREAD,  2 data records read from input file.
    %RMU-I-DATRECSTO,   2 data records stored.

    SQL> ATTACH 'FILENAME MF_PERSONNEL.RDB';
    SQL> SELECT * FROM EMPLOYEES WHERE EMPLOYEE_ID > '98000'
    cont> AND MIDDLE_INITIAL IS NULL;
     EMPLOYEE_ID   LAST_NAME        FIRST_NAME   MIDDLE_INITIAL
       ADDRESS_DATA_1              ADDRESS_DATA_2         CITY
          STATE   POSTAL_CODE   SEX    BIRTHDAY      STATUS_CODE
     98888         ABUSHAKRA        CAROLINE     NULL
       5 CIRCLE STREET             BOX 506                CHELMSFORD
          MA      02184         ?      14-Jun-1960   N

     98889         BRADFORD         LEO          NULL
       4 PLACE STREET              BOX 555                NASHUA
          NH      03060         ?      18-May-1949   N

    2 rows selected

    Example 17

    The following example demonstrates the use of the Null="" option
    of the Record_Definition qualifier to signal to Oracle RMU that
    any data that is an empty string in the .unl file (as represented
    by two commas with no space separating them) should have the
    corresponding column in the database be flagged as NULL.

    The example shows the contents of the .unl file, followed by the
    RMU Load command used to load this .unl file, and then the output
    from an SQL statement to display the data loaded.

    "90021","ABUSHAKRA","CAROLINE","A","5 CIRCLE STREET",,
    "CHELMSFORD", "MA", "02184", "1960061400000000"#
    "90015","BRADFORD","LEO","B","4 PLACE STREET",, "NASHUA","NH",
    "03030", "1949051800000000"#

    $ RMU/LOAD/FIELDS=(EMPLOYEE_ID, LAST_NAME, FIRST_NAME, -
    _$ MIDDLE_INITIAL, ADDRESS_DATA_1, ADDRESS_DATA_2,  -
    _$ CITY, STATE, POSTAL_CODE, BIRTHDAY) -
    _$ /RECORD_DEFINITION=(FILE= EMPLOYEES.RRD, -
    _$ FORMAT=DELIMITED_TEXT, -
    _$ TERMINATOR="#", -
    _$ NULL="") -
    _$ MF_PERSONNEL EMPLOYEES EMPLOYEES.UNL
    %RMU-I-DATRECREAD,  2 data records read from input file.
    %RMU-I-DATRECSTO,   2 data records stored.

    $ SQL
    SQL> ATTACH 'FILENAME MF_PERSONNEL.RDB';
    SQL> SELECT * FROM EMPLOYEES WHERE ADDRESS_DATA_2 IS NULL;
     EMPLOYEE_ID   LAST_NAME        FIRST_NAME   MIDDLE_INITIAL
       ADDRESS_DATA_1              ADDRESS_DATA_2         CITY
          STATE   POSTAL_CODE   SEX    BIRTHDAY      STATUS_CODE
     90021         ABUSHAKRA        CAROLINE     A
       5 CIRCLE STREET             NULL                   CHELMSFORD
          MA      02184         ?      14-Jun-1960   N

     90015         BRADFORD         LEO          B
       4 PLACE STREET              NULL                   NASHUA
          NH      03030         ?      18-May-1949   N

    2 rows selected

    Example 18

    The following example is the same as Example 17 except it shows
    the use of the default value for the Null option of the Record_
    Definition qualifier to signal to Oracle RMU that any data that
    is an empty string in the .unl file (as represented by two commas
    with no space separating them) should have the corresponding
    column in the database be flagged as NULL.

    The example shows the contents of the .unl file, followed by the
    RMU Load command used to load this .unl file, and then the output
    from an SQL statement to display the data loaded.

    "90022","ABUSHAKRA","CAROLINE","A","5 CIRCLE STREET",,
    "CHELMSFORD", "MA", "02184", "1960061400000000"#
    "90014","BRADFORD","LEO","B","4 PLACE STREET",, "NASHUA","NH",
    "03030", "1949051800000000"#

    $ RMU/LOAD/FIELDS=(EMPLOYEE_ID, LAST_NAME, FIRST_NAME, -
    _$ MIDDLE_INITIAL, ADDRESS_DATA_1, ADDRESS_DATA_2,  -
    _$ CITY, STATE, POSTAL_CODE, BIRTHDAY) -
    _$ /RECORD_DEFINITION=(FILE= EMPLOYEES.RRD, -
    _$ FORMAT=DELIMITED_TEXT, -
    _$ TERMINATOR="#", -
    _$ NULL) -
    _$ MF_PERSONNEL EMPLOYEES EMPLOYEES.UNL
    %RMU-I-DATRECREAD,  2 data records read from input file.
    %RMU-I-DATRECSTO,   2 data records stored.

    $ SQL
    SQL> ATTACH 'FILENAME MF_PERSONNEL.RDB';
    SQL> SELECT * FROM EMPLOYEES WHERE EMPLOYEE_ID = '90022' OR
    cont> EMPLOYEE_ID ='90014' AND ADDRESS_DATA_2 IS NULL;
     EMPLOYEE_ID   LAST_NAME        FIRST_NAME   MIDDLE_INITIAL
       ADDRESS_DATA_1              ADDRESS_DATA_2         CITY
          STATE   POSTAL_CODE   SEX    BIRTHDAY      STATUS_CODE
     90014         BRADFORD         LEO          B
       4 PLACE STREET              NULL                   NASHUA
          NH      03030         ?      18-May-1949   N

     90022         ABUSHAKRA        CAROLINE     A
       5 CIRCLE STREET             NULL                   CHELMSFORD
          MA      02184         ?      14-Jun-1960   N

    2 rows selected

    Example 19

    The following example demonstrates the use of the Null option of
    the Record_Definition qualifier to signal to Oracle RMU that any
    data that is an empty string in the .unl file (as represented
    by two commas with no space separating them) should have the
    corresponding column in the database be flagged as NULL. In
    addition, any column for which there is only data for the first
    column or columns has the remaining columns set to NULL.

    The example shows the contents of the .unl file, followed by the
    RMU Load command used to load this .unl file, and then the output
    from an SQL statement to display the data loaded.

    "90026","ABUSHAKRA","CAROLINE","A","5 CIRCLE STREET","BOX 783",
    "CHELMSFORD","MA", "02184", "1960061400000000"
    "90011","BRADFORD","LEO",,,, "NASHUA","NH","03030","1949051800000000"
    "90010"
    "90009",,,,,,,,,"1966061600000000"

    $ RMU/LOAD/FIELDS=(EMPLOYEE_ID, LAST_NAME, FIRST_NAME, -
    _$ MIDDLE_INITIAL, ADDRESS_DATA_1, ADDRESS_DATA_2,  -
    _$ CITY, STATE, POSTAL_CODE, BIRTHDAY) -
    _$ /RECORD_DEFINITION=(FILE= EMPLOYEES.RRD, -
    _$ FORMAT=DELIMITED_TEXT, -
    _$ NULL) -
    _$ MF_PERSONNEL EMPLOYEES EMPLOYEES.UNL
    %RMU-I-DATRECREAD,  5 data records read from input file.
    %RMU-I-DATRECSTO,   5 data records stored.
    $ SQL
    SQL> ATTACH 'FILENAME MF_PERSONNEL.RDB';
    SQL> SELECT * FROM EMPLOYEES WHERE EMPLOYEE_ID ='90026' OR
    cont> EMPLOYEE_ID BETWEEN '90009' AND '90011';
     EMPLOYEE_ID   LAST_NAME        FIRST_NAME   MIDDLE_INITIAL
       ADDRESS_DATA_1              ADDRESS_DATA_2         CITY
          STATE   POSTAL_CODE   SEX    BIRTHDAY      STATUS_CODE
     90009         NULL             NULL         NULL
       NULL                        NULL                   NULL
          NULL    NULL          ?      16-Jun-1966   N

     90010         NULL             NULL         NULL
       NULL                        NULL                   NULL
          NULL    NULL          ?      NULL          N

     90011         BRADFORD         LEO          NULL
       NULL                        NULL                   NASHUA
          NH      03030         ?      18-May-1949   N

     90026         ABUSHAKRA        CAROLINE     A
       5 CIRCLE STREET             BOX 783                CHELMSFORD
          MA      NULL          ?      14-Jun-1960   N

    4 rows selected

    Example 20

    The following example demonstrates a parallel load operation.
    In this example, three executors are specified because there are
    three storage areas in the JOB_HISTORY table of the mf_personnel
    database. The Defer_Index_Updates qualifier is used because there
    are no constraints or triggers defined on the JOB_HISTORY table,
    and it is known that no other database activity will occur when
    this command is executed.

    In addition, a plan file is generated to capture the
    specification of this load operation. See the next example for
    a description of the plan file.

    Note that the pid provided in the output from this command is the
    process ID.

    $ RMU/LOAD/PARALLEL=(EXEC=3)/DEFER_INDEX_UPDATES mf_personnel.rdb -
    _$ /RECORD_DEFINITION=(FILE=JOB_HIST,FORMAT=DELIMITED_TEXT, -
    _$ EXCEPTION_FILE=DISK1:[ERRORS]JOB_HIST.EXC) -
    _$ /STATISTICS=(INTERVAL=30)/LIST_PLAN=JOB_HISTORY.PLAN -
    _$ JOB_HISTORY JOB_HIST.UNL
    %RMU-I-EXECUTORMAP, Executor EXECUTOR_1 (pid: 2941941B) will load
     storage area EMPIDS_LOW.
    %RMU-I-EXECUTORMAP, Executor EXECUTOR_2 (pid: 2941F01D) will load
     storage area EMPIDS_MID.
    %RMU-I-EXECUTORMAP, Executor EXECUTOR_3 (pid: 2941C81F) will load
     storage area EMPIDS_OVER.

    --------------------------------------------------------------------------
    ELAPSED: 0 00:00:30.05 CPU: 0:00:01.64 BUFIO: 59 DIRIO: 219 FAULTS: 2670

     1640 data records read from input file.
      1330 records loaded before last commit.
      220 records loaded in current transaction.
      0 records rejected before last commit.
      0 records rejected in current transaction.
     26 early commits by executors.
      3 executors:  0 Initializing; 0 Idle; 0 Terminated
                    0 Sorting; 2 Storing; 1 Committing; 0 Executing
    --------------------------------------------------------------------------
       .
       .
       .
    --------------------------------------------------------------------------
    ELAPSED: 0 00:02:30.12 CPU: 0:00:02.94 BUFIO: 103 DIRIO: 227  FAULTS: 267
    1
     8070 data records read from input file.
      7800 records loaded before last commit.
      210 records loaded in current transaction.
      0 records rejected before last commit.
      0 records rejected in current transaction.
    139 early commits by executors.
      3 executors:  0 Initializing; 0 Idle; 0 Terminated
                    0 Sorting; 1 Storing; 2 Committing; 0 Executing
    ---------------------------------------------------------------------------

    %RMU-I-EXECSTAT0, Statistics for EXECUTOR_1:
    %RMU-I-EXECSTAT1,   Elapsed time:  00:02:45.84    CPU time:       12.95
    %RMU-I-EXECSTAT2,   Storing time:  00:00:45.99    Rows stored:    2440
    %RMU-I-EXECSTAT3,   Commit time:   00:01:33.17    Direct I/O:     6623
    %RMU-I-EXECSTAT4,   Idle time:     00:00:22.34    Early commits:  47

    %RMU-I-EXECSTAT0, Statistics for EXECUTOR_2:
    %RMU-I-EXECSTAT1,   Elapsed time:  00:02:48.42    CPU time:       18.10
    %RMU-I-EXECSTAT2,   Storing time:  00:01:24.98    Rows stored:    4319
    %RMU-I-EXECSTAT3,   Commit time:   00:01:18.13    Direct I/O:     9621
    %RMU-I-EXECSTAT4,   Idle time:     00:00:01.03    Early commits:  29

    %RMU-I-EXECSTAT0, Statistics for EXECUTOR_3:
    %RMU-I-EXECSTAT1,   Elapsed time:  00:02:46.50    CPU time:       9.78
    %RMU-I-EXECSTAT2,   Storing time:  00:00:11.12    Rows stored:    2293
    %RMU-I-EXECSTAT3,   Commit time:   00:02:26.67    Direct I/O:     3101
    %RMU-I-EXECSTAT4,   Idle time:     00:00:04.14    Early commits:  77

    %RMU-I-EXECSTAT5,   Main process idle time:  00:02:41.06
    %RMU-I-DATRECREAD,  9052 data records read from input file.
    %RMU-I-DATRECSTO,   9052 data records stored.
    %RMU-I-DATRECREJ,   0 data records rejected.

    Example 21

    The following command is the same as in the previous example,
    except the Noexecute qualifier is specified. Because this
    qualifier is specified, the load operation is not performed.
    However, the load plan file is created and verified.

    $ RMU/LOAD/PARALLEL=(EXEC=3)/DEFER_INDEX_UPDATES/NOEXECUTE -
    _$  mf_personnel.rdb -
    _$ /RECORD_DEFINITION=(FILE=JOB_HIST,FORMAT=DELIMITED_TEXT, -
    _$ EXCEPTION_FILE=DISK1:[ERRORS]JOB_HIST.EXC) -
    _$ /STATISTICS=(INTERVAL=30)/LIST_PLAN=JOB_HISTORY.PLAN -
    _$ JOB_HISTORY JOB_HIST.UNL

    Example 22

    The following display shows the contents of the plan file,
    JOB_HISTORY.PLAN, created in the preceding example. The following
    callouts are keyed to this display:

    1  The Plan Parameters include all the parameters specified on
       the RMU Load command line and all possible command qualifiers.

    2  Command qualifiers that are not specified on the command line
       are sometimes represented as comments in the plan file. This
       allows you to edit and adjust the plan file for future use.

    3  Command qualifiers that are not specified on the command line
       and for which there are defaults are sometimes represented
       with their default value in the plan file.

    4  Command qualifiers that are explicitly specified on the
       command line are represented in the plan file as specified.

    5  Executor Parameters are listed for each executor involved
       in the load operation. Like the command qualifiers, both the
       values you specify on the command line and those that are
       allowed but were not specified are included in this list of
       parameters.

    6  Note that the exception file extension is appended with the
       executor number. When you specify such files on the command
       line, Oracle RMU generates a separate file for each executor.
       If desired, you could edit this plan file to place each
       exception file on a different disk or directory.

    ! Plan created on 20-JUL-1995 by RMU/LOAD.

    Plan Name = LOAD_PLAN
    Plan Type = LOAD

    Plan Parameters:1
        Database Root File = MF_PERSONNEL.RDB;
        Table Name = JOB_HISTORY
        Input File = JOB_HIST.UNL

        ! Fields = <all> 2
        Transaction_Type = PROTECTED
        ! Buffers = <default>

        Row_Count = 50 3
        ! Skip = <none>
        NoLog_Commits
        NoCorresponding
        Defer_Index_Updates
        Constraints
        Parallel
        NoPlace
        Statistics = INTERVAL = 30 4
        NoTrigger_Relations
        Record_Definition_File = JOB_HIST
            Format = Delimited_Text
                Prefix = """"
                Suffix = """"
                NoNull
                Separator = ","
                End Of Line Terminator
    End Plan Parameters

    Executor Parameters: 5
        Executor Name = EXECUTOR_1
        ! Place_Only = <none>
        Exception_File = DISK1:[DATABASE]JOB_HIST.EXC_1; 6
        ! RUJ Directory = <default>
        Communication Buffers = 4
    End Executor Parameters

    Executor Parameters:
        Executor Name = EXECUTOR_2
        ! Place_Only = <none>
        Exception_File = DISK1:[DATABASE]JOB_HIST.EXC_2;
        ! RUJ Directory = <default>
        Communication Buffers = 4
    End Executor Parameters

    Executor Parameters:
        Executor Name = EXECUTOR_3
        ! Place_Only = <none>
        Exception_File = DISK1:[DATABASE]JOB_HIST.EXC_3;
        ! RUJ Directory = <default>
        Communication Buffers = 4
    End Executor Parameters

    Example 23

    The following example demonstrates the structure of the record
    definition file (.rrd) for an RMU Load command for several
    different data types. The first part of the example displays the
    table definition, the second part shows the RMU Unload command
    you could use to get an appropriate .rrd file for these data
    types, and the last part shows the .rrd file definitions for
    these data types:

    SQL> attach 'filename data_types.rdb';
    SQL> show table many_types;
    Information for table MANY_TYPES

    Columns for table MANY_TYPES:
    Column Name                     Data Type        Domain
    -----------                     ---------        ------
    F_ID                            TINYINT
    F_CHAR_3                        CHAR(3)
    F_TINYINT                       TINYINT
    F_SMALLINT                      SMALLINT
    F_INTEGER                       INTEGER
    F_BIGINT                        BIGINT
    F_NTINYINT                      TINYINT(1)
    F_NSMALLINT                     SMALLINT(2)
    F_NINTEGER                      INTEGER(7)
    F_NBIGINT                       BIGINT(5)
    F_REAL                          REAL
    F_DOUBLE_PREC                   DOUBLE PRECISION
    F_DATE_VMS                      DATE VMS
    F_DATE_ANSI                     DATE ANSI
    F_VARCHAR                       VARCHAR(20)
    F_FLOAT                         REAL
    F_DATE                          DATE VMS
    F_TIME                          TIME
    F_TIMESTAMP                     TIMESTAMP(2)
    F_INTERVAL                      INTERVAL
                                     DAY (2)

    $ RMU/UNLOAD DATA_TYPES.RDB/RECORD_DEF=(FILE=MANY_TYPES.RRD) -
    _$ MANY_TYPES MANY_TYPES.UNL

    $ TYPE MANY_TYPES.RRD
    DEFINE FIELD F_ID DATATYPE IS SIGNED BYTE.
    DEFINE FIELD F_CHAR_3 DATATYPE IS TEXT SIZE IS 3.
    DEFINE FIELD F_TINYINT DATATYPE IS SIGNED BYTE.
    DEFINE FIELD F_SMALLINT DATATYPE IS SIGNED WORD.
    DEFINE FIELD F_INTEGER DATATYPE IS SIGNED LONGWORD.
    DEFINE FIELD F_BIGINT DATATYPE IS SIGNED QUADWORD.
    DEFINE FIELD F_NTINYINT DATATYPE IS SIGNED BYTE SCALE -1.
    DEFINE FIELD F_NSMALLINT DATATYPE IS SIGNED WORD SCALE -2.
    DEFINE FIELD F_NINTEGER DATATYPE IS SIGNED LONGWORD SCALE -7.
    DEFINE FIELD F_NBIGINT DATATYPE IS SIGNED QUADWORD SCALE -5.
    DEFINE FIELD F_REAL DATATYPE IS F_FLOATING.
    DEFINE FIELD F_DOUBLE_PREC DATATYPE IS G_FLOATING.
    DEFINE FIELD F_DATE_VMS DATATYPE IS DATE.
    DEFINE FIELD F_DATE_ANSI DATATYPE IS DATE ANSI.
    DEFINE FIELD F_VARCHAR DATATYPE IS TEXT SIZE IS 20.
    DEFINE FIELD F_FLOAT DATATYPE IS F_FLOATING.
    DEFINE FIELD F_DATE DATATYPE IS DATE.
    DEFINE FIELD F_TIME DATATYPE IS TIME.
    DEFINE FIELD F_TIMESTAMP DATATYPE IS TIMESTAMP SCALE -2.
    DEFINE FIELD F_INTERVAL DATATYPE IS INTERVAL DAY SIZE IS 2 DIGITS.
    DEFINE RECORD MANY_TYPES.
       F_ID .
       F_CHAR_1 .
     . . .
    END MANY_TYPES RECORD.

    Example 24

    The following example shows part of a script for loading a copy
    of the PERSONNEL database using the output from SQL EXPORT.

    $! Export the database definition and the data
    $ sql$ export database filename personnel into pers.rbr;
    $
    $! Create an empty database (use RMU Load to add data)
    $ sql$ import database from pers.rbr filename copy_pers no data;
    $
    $! Now use load to add the same table
    $ rmu/load copy_pers /match_name=employees employees pers.rbr
    %RMU-I-DATRECREAD,  100 data records read from input file.
    %RMU-I-DATRECSTO,   100 data records stored.
    $
    $ rmu/load copy_pers /match_name job_history pers.rbr
    %RMU-I-DATRECREAD,  274 data records read from input file.
    %RMU-I-DATRECSTO,   274 data records stored.
    $
    $ rmu/load copy_pers /match_name salary_history pers.rbr
    %RMU-I-DATRECREAD,  729 data records read from input file.
    %RMU-I-DATRECSTO,   729 data records stored.
    $
       .
       .
       .
    $ rmu/load copy_pers /match_name work_status pers.rbr
    %RMU-I-DATRECREAD,  3 data records read from input file.
    %RMU-I-DATRECSTO,   3 data records stored.

    Example 25

    The following example shows that, by default, truncation errors
    during a Load are reported.

    $ rmu/load abc f2 f1
    %RMU-I-LOADERR, Error loading row 1.
    %RDB-E-TRUN_STORE, string truncated during assignment to a column
    %RMU-I-DATRECREAD,  1 data records read from input file.
    %RMU-I-DATRECSTO,   0 data records stored.
    %RMU-F-FTL_LOAD, Fatal error for LOAD operation at 13-FEB-2008 15:39:44.40
    $

    Example 26

    The following example shows the use of the /VIRTUAL_FIELDS
    qualifier. The values of the INTEGER field A and the AUTOMATIC
    field B are first unloaded into the AA.UNL file from the RMU_
    LOAD_AUTOMATIC_4_DB database table AA using the /VIRTUAL_
    FIELDS qualifier. Then the values of the INTEGER field A and
    the AUTOMATIC field B in the AA.UNL file are loaded into the AA
    table in the RMU_LOAD_AUTOMATIC_4_DB2 database.

    $ SQL
    create database
        filename RMU_LOAD_AUTOMATIC_4_DB;

    -- create a sequence and a table
    create sequence S increment by -1;
    create table AA
        (a integer
        ,b automatic as s.nextval);

    -- load 10 rows
    begin
    declare :i integer;
    for :i in 1 to 10
    do
        insert into AA (a) values (:i);
    end for;
    end;
    commit;
    disconnect all;
    $ exit
    $       rmu/unload-
                /virtual=(automatic)-
                /record=(file=rr,format=delim)-
                RMU_LOAD_AUTOMATIC_4_DB aa aa.unl
    %RMU-I-DATRECUNL,   10 data records unloaded.
    $
    $
    $! Load using /VIRTUAL
    $       rmu/load-
                /record=(file=rr,format=delim)-
                /virtual-
                RMU_LOAD_AUTOMATIC_4_DB2 aa aa.unl
    %RMU-I-DATRECREAD,  10 data records read from input file.
    %RMU-I-DATRECSTO,   10 data records stored.
    $
Close Help