SQL/MP Installation and Management Guide

Reorganizing Tables and Maintaining Data
HP NonStop SQL/MP Installation and Management Guide523353-004
8-12
Examples of Loading Tables
This example loads data into a table from an Enscribe file. The LOAD command with
the MOVE option specifies explicit matching of the source fields and target columns.
The source file and target table have these differences:
DELIV_DATE is a new column not in the source file; this field must be defined with
a DEFAULT option to perform the LOAD.
The CUST_PO column size has been increased by five bytes.
The ITEM-LIST OCCURS clause has been broken into the 10 element fields.
The Enscribe record layout of the source file follows:
* Record Layout for $ENSC.SALES.ORDERS
01 ORDERS.
02 ORDER-KEY.
05 ORDER-NUM PIC 9(6).
05 ORDERED-DATE PIC S9(6) COMP.
02 SALESMAN PIC 9(4).
02 CUSTOMER-INFO.
05 CUSTOMER-PO-NUM PIC X(30).
02 CUSTOMER-NUMBER PIC 9(4).
02 ITEM-LIST PIC X(4)
OCCURS 10 TIMES.
The SQL table layout of the target table follows. The table must be created before the
LOAD operation.
>> INVOKE $VOL1.SALES.ORDERS FORMAT COBOL85;
* Record Definition for table \SYS1.$VOL1.SALES.ORDERS
* Definition current at 09:07:21 - 04/12/89
01 ORDERS.
02 ORDERNUM PIC 9(6).
02 ORDER-DATE PIC S9(6) COMP.
02 DELIV-DATE PIC S9(6) COMP.
02 SALESREP PIC 9(4).
02 CUST-PO PIC X(35).
02 CUSTNUM PIC 9(4).
02 ITEM-1 PIC X(4).
02 ITEM-2 PIC X(4).
02 ITEM-3 PIC X(4).
02 ITEM-4 PIC X(4).
02 ITEM-5 PIC X(4).
02 ITEM-6 PIC X(4).
02 ITEM-7 PIC X(4).
02 ITEM-8 PIC X(4).
02 ITEM-9 PIC X(4).
02 ITEM-10 PIC X(4).
Next is the LOAD command to load the Enscribe file into the new SQL table. The
MOVE option explicitly names all the field-to-column conversions. The source file
OCCURS array is subscripted in the MOVE clause to the target data element of the
table.