Iconv & Oconv logic

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
kamaldeep.kaur
Participant
Posts: 17
Joined: Thu Oct 26, 2006 12:47 am
Location: chennai

Iconv & Oconv logic

Post by kamaldeep.kaur »

Hi all,

I am using Oconv function to convert @DATE to YYYY/MM/DD format.
As @DATE output is 15894 which is today's date "07/07/2011".

But when i apply Oconv(@DAY,"D/YMD[4,2,2]") its gives output as "1968/01/07".

Please suggest how these Iconv and Oconv functions works and how i got the above error

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

Post by ray.wurlod »

@DAY is the day of the month. It only has values between 1 and 31. So applying that Oconv() function to it could only yield values in the range "1968-01-01" through "1968-01-31". Clearly you executed it on the seventh of the month.

To put it another way, @DAY and @DATE are not the same thing.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kamaldeep.kaur
Participant
Posts: 17
Joined: Thu Oct 26, 2006 12:47 am
Location: chennai

Post by kamaldeep.kaur »

sorry it was typo i used @DATE instead of @DAY
Oconv(@DATE,"D/YMD[4,2,2]")

still i get "1968-01-07"??

Kamal
vasubabu
Participant
Posts: 153
Joined: Wed Jan 25, 2006 2:38 am

Post by vasubabu »

Try this

Oconv(iconv(@DATE,"D/E") ,"D/YMD[4,2,2]")
VASU..
hemanthakumar
Participant
Posts: 34
Joined: Mon May 05, 2008 1:31 am

Post by hemanthakumar »

Hi Kamal,
The below code is working fine, it gives the correct output "2011/07/13"

Code: Select all

Oconv(@DATE,"D/YMD[4,2,2]") 
.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yah, there was nothing wrong with the OConv you posted. If you still have the issue, show us exactly how/where you are using it, something else is causing the issue.
-craig

"You can never have too many knives" -- Logan Nine Fingers
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post by PhilHibbs »

kamaldeep.kaur wrote:still i get "1968-01-07"??
So, 5 days later you still get the same result? Can't be the server clock set wrong then, I guess.
Phil Hibbs | Capgemini
Technical Consultant
Post Reply