Howto convert data in an INTEGER column to a standard DB2 DATE column using Fast Unload and Fast Load?

Document ID : KB000028134
Last Modified Date : 14/02/2018
Show Technical Document Details

 

Question:

Howto convert data in an INTEGER column to a standard DB2 DATE column using Fast Unload and Fast Load?

 

Answer:

First code Fast Unload field specifications to convert the field(s) in question to the following syntax:

SELECT COLA, COLB, COLC
INTO
COLA     CHAR(10),       
COLB     CHAR(1),        
COLC     INTEGER EXTERNAL	
FROM owner.TABLEA;

Where COLC is an INTEGER column on TABLEA.

Then code Fast Load to convert COLC to a DB2 DATE format YYYYMMDD via:

INTO TABLE  Owner.TABLEB                  
 (                                            
  COLA               POSITION(      1:    10 )
    CHAR               (    10)               
        ,                                     
  COLB               POSITION(     11:    11 )
      CHAR               (     1)             
        ,                                     
  COLC               POSITION(     15:    22 )
    DATE-3             (    08)               
 )