Converting String to Month

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
dodda
Premium Member
Premium Member
Posts: 244
Joined: Tue May 29, 2007 11:31 am

Converting String to Month

Post by dodda »

Hello

I have a requirement where i am getting a string like 01-JAN-2009 from file. I have to use some logic in such a way that i need to extract JAN and convert that to 01. if get 01-FEB-2009 then i need to get 02 and so on. Is there a function to get that value.

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

(Index("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC", InLink.TheString[4,3], 1) - 1) / 3 + 1
for the month number. Store that in stage variable svMonthNumber.

Code: Select all

Right("00" : svMonthNumber, 2)
will yield that number with a leading zero if necessary.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply