date conversion

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
harikumar
Participant
Posts: 33
Joined: Wed Apr 21, 2010 9:19 pm
Location: banglore

date conversion

Post by harikumar »

Hi ,

I have source format like 1456(2007-10-01) and in target i want to populate date as 20071001.

I have gone through the search but i didn't.

Thanks,
Harikumar
Last edited by harikumar on Thu Sep 22, 2011 1:16 am, edited 1 time in total.
premupdate
Participant
Posts: 47
Joined: Thu Oct 04, 2007 3:37 am
Location: chennai

Post by premupdate »

Have you tried OCONV function..
Cheers,
prem
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You have to extract the date portion from the input string, perhaps using substring if the size is constant or Field() functions otherwise. Then all you need to do is to convert the hyphen characters to empty string ("") in the result.

Code: Select all

Convert("-", "", Field(Field(InLink.TheString, ")", 1, 1), "(", 2, 1))
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
harikumar
Participant
Posts: 33
Joined: Wed Apr 21, 2010 9:19 pm
Location: banglore

date conversion

Post by harikumar »

premupdate wrote:Have you tried OCONV function..
I have choosed mistakenly server edition but this prob related to parllel edition
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

My solution will work with either edition.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Re: date conversion

Post by BI-RMA »

Hello harikumar,

Is your input value a date-format as shown in the view-data grid of for example a DB2-stage (even though I would expect the numeric value to be 14519 then)?

If your column is in date-format you can convert it using DateToString(%date%,"%yyyy%mm%dd"). This will return the string '20071001' (not a date).
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
Post Reply