I have a flat file, which has dates in packed format (CYYMMDD) among other fields, and I would like to load this file into my DB2 table. I would like to be able to convert the 'DATE' on the fly to DB2's DATE format (MMDDYYYY) while doing the loading. Is this possible?
My second question is, is there anyway to specify that for the whole flat file, if there is a field that is all X'FF' then it should be treated as NULL inside DB2?
You can do this by the help of some changes in the LOAD card
use the DATE EXTERNAL as an attribute for that particular coloum like
( <col 1> <position()> <type>,
<col n> <position()> DATE EXTERNAL)
this will tell DB2 that the particular coloumn contains the DATE and DB2 will store it in the required format.
For your second question use NULLIF() = ' ' with the column attribute like <col> <position> <type> NULLIF ( ) = ' '
since 4F is actually blank. DB2 will take the input as NULL in the case when IF condition is true.