Home | Previous Page | Next Page   Disk, Memory, and Process Management > Loading with External Tables for Extended Parallel Server > Loading, Unloading, and Reorganizing Data >

Loading from an IBM Fixed-EBCDIC File

You can load and unload IBM-format data files. As an example, consider the following IBM employee data file:

CREATE TABLE employee 
  ( name CHAR(18), 
    salary DECIMAL(7,2), 
    hiredate DATE, 
    empno INTEGER 

The following SQL statements load the data from the emp_exp external table to the employee table:

CREATE EXTERNAL TABLE emp_ext 
  ( name CHAR(18) EXTERNAL CHAR(18), 
    salary DECIMAL(7,2) EXTERNAL "PACKED(7,2)", 
    hiredate DATE EXTERNAL CHAR(10), 
    empno INTEGER EXTERNAL "BINARY(4)" ) 
USING ( 
  FORMAT 'FIXED', 
  CODESET "EBCDIC", 
  DATAFILES ("DISK:1:/work2/mydir/emp.fix") 
  ) ; 
INSERT INTO employee SELECT * FROM emp_ext; 

The packed-decimal salary (seven digits, two of them after the decimal point) is stored in four bytes. Three bytes contain six of the digits. The fourth byte contains the seventh digit and the sign.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]