String to Timestamp Conversion having Null in Source

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
anshulroy
Participant
Posts: 5
Joined: Thu Mar 26, 2009 12:25 pm
Location: Chennai

String to Timestamp Conversion having Null in Source

Post by anshulroy »

Hi, We are reading the source file in VarChar Format & performing the column metadata conversion in transformer as per the target metadata. In one of the file, a column is Null in Source file. The target for this column is Timestamp. I have tried all ways of Null Handling, assigning default and converting the column to setNull, but in all the ways its givig me warning & the record is getting dropped.
Is there anyway that the Null from source gets converted to Null to target for the timestamp column without giving warning and dropping the record ?
ANSHUL
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

What exactly is the warning you are receiving?

Seeing as the source is a sequential file, is the "null" column actually an empty string (0 bytes in length) or nothing but spaces or other character value? If so, then you could simply check for that condition. For instance, if an empty string or only spaces represents a null value:

If trim(input.date)='' then setNull() else StringToTimestamp(input.date,format_string)

Making certain, of course, that the output column is a nullable Timestamp.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
anshulroy
Participant
Posts: 5
Joined: Thu Mar 26, 2009 12:25 pm
Location: Chennai

Post by anshulroy »

Hi,
I have done the above code. But got warning.
APT_CombinedOperatorController(0),0: Conversion error calling conversion routine timestamp_from_string data may have been lost

My Source value is Null or ''. I did implement handing both the cases.
Whatever change i am doing, but i am getting this warning. Is there anyway or any code that i can use and do not get this warning.
ANSHUL
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

What does your incoming data look like? Is it always in the same format (and have you verified so by looking at the data or running analysis on it)?

Can you show the StringToTimestamp() call you have written?

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Show us some of your incoming data and your null handling syntax.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply