How to convert data in an INTEGER column to a standard Db2 DATE column using Fast Unload and Fast Load
search cancel

How to convert data in an INTEGER column to a standard Db2 DATE column using Fast Unload and Fast Load

book

Article ID: 28134

calendar_today

Updated On:

Products

Fast Unload for DB2 for z/OS Fast Load for DB2 for z/OS

Issue/Introduction

How to convert data in an INTEGER column to a standard Db2 DATE column using Fast Unload for Db2 for z/OS (PFU)
and Fast Load for Db2 for z/OS (PFL).

Resolution

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)               
 )