Problem converting date formats

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
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Problem converting date formats

Post by yaminids »

Friends,

I'm trying to create a new job which parses a Sequential file and populates a staging table.

The problem is with one of the date columns present in the file. The format of the data is "Jul 31 2009" (MM DD YYYY) whereas the DataStage function ICONV expects it in "DD MM YYYY".

How can I convert this format so that I can populate the table

Thanks
Yamini
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

First off, "Jul 31 2009" is not "MM DD YYYY" but rather "MON DD YYYY" and secondly IConv only has expectations if you don't help it so use the appropriate mask to tell it what format the string that needs to be converted is coming in as.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

As this article shows, Iconv() is rather agnostic about such niceties. All you need is the order of the components to be right.

Code: Select all

Iconv(InLink.TheDate, "DMDY") 
will convert any date in any legal format in month-day-year order into DataStage internal format (number of days since 1967-12-31).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Post by yaminids »

Thanks for the information.
I have modified the job to OCONV(ICONV(dslink3.indate,"DMDY"),"D-YMD[4,2,2]") and it worked

Thanks
Yamini
Post Reply