date format

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
vardhan354
Participant
Posts: 76
Joined: Wed Jan 25, 2006 6:42 pm

date format

Post by vardhan354 »

Hi,

i have source sequential file Date (varchar),

Target oracle database Date(Timestamp).

in transformer i am using the oconv like this

oconv(iconv(DSLINK2.COLUMN NAME, "DYMD"), "D-YMD[4,2,2]")

please correct me from wrong.

Thanks for your help.
ETL
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Firstly, are you getting any error messages?

Does your input contain timepart or is it only date. If so, and if your target datatype is Timestamp then you will have to append 00:00:00 at the end of your derivation and that will work.
Kris

Where's the "Any" key?-Homer Simpson
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Re: date format

Post by DeepakCorning »

[quote="vardhan354"]
i have source sequential file Date (varchar),
quote]

What is the format in the sequential file for the date field , for e.g. is it MMDDYYYY or DDMMYYYY as your usage of ICONV will depend on what format you receiveing.
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Re: date format

Post by DeepakCorning »

I think I messed up with the quoting thing...:)
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Hi
As datatype is a timestamp you need to concatenate the date with time.

Code: Select all

oconv(iconv(DSLINK2.COLUMN NAME, "DYMD"), "D-YMD[4,2,2]") : "00:00:00"
Target oracle database Date(Timestamp).

in transformer i am using the oconv like this

oconv(iconv(DSLINK2.COLUMN NAME, "DYMD"), "D-YMD[4,2,2]")

please correct me from wrong.
vardhan354
Participant
Posts: 76
Joined: Wed Jan 25, 2006 6:42 pm

Post by vardhan354 »

thanks for youre response meena, Deepak.


The source date format is dd-mm-yyyy,

there is no timestamp in source.

Basing on this information is this correct

oconv(iconv(DSLINK2.COLUMN NAME, "DYMD"), "D-YMD[4,2,2]")


Thanks,
ETL
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Hi,
I am not talking about the source datatype. I am talking about the target datatype.You mentioned it as Timestamp.Based on the input, your conversion is wrong.Check at Iconv funtion. Check this

Code: Select all

oconv(iconv(DSLINK2.COLUMN NAME, "D-DMY[2,2,4]"), "D-YMD[4,2,2]"):"00:00:00" 
vardhan354 wrote:thanks for youre response meena, Deepak.


The source date format is dd-mm-yyyy,

there is no timestamp in source.

Basing on this information is this correct

oconv(iconv(DSLINK2.COLUMN NAME, "DYMD"), "D-YMD[4,2,2]")


Thanks,
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Post by DeepakCorning »

....To be more safe (As it is a flat file) i will use Z,Z,4 in the iconv function...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It doesn't matter. Iconv() is clever enough to work it out. All you must provide is the first "D" and the date component designators (for example "MDY").
This article may help to explain why this is so.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
changming
Participant
Posts: 68
Joined: Wed Oct 13, 2004 3:35 am

give the oracle varchar format

Post by changming »

if your source date format is varchar dd-mm-yyyy,
just use substring function to convert it to yyyymmdd.
Orcale will work very well on this string.
Post Reply