Iconv Oconv Issue

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
Amit_111
Participant
Posts: 134
Joined: Sat Mar 24, 2007 11:37 am

Iconv Oconv Issue

Post by Amit_111 »

Hi All,

I am getting a strange issue with Iconv Oconv function. I have generated a function to retrive a date and insert it in the target table.

The function i have written is as follows :
" OCONV(ICONV("Column_Name","D-MDY"),"D YMD[4,2,2]") "

It is working fine for some dates and they are geting inserted properly in the target but for some dates it is sending blank. On further analyzing this issue deeper i found out that dates having day > 15 for e.g. 15th Sep 2008 is going as blank but a date like 2nd SEP 2008 is going fine as is in the target .
Not able to conclude why this is happening. any pointers on this issue are welcomed. Thanks in Advance
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Re: Iconv Oconv Issue

Post by sachin1 »

please let us know the input format of date, give an example of your input date.
Amit_111
Participant
Posts: 134
Joined: Sat Mar 24, 2007 11:37 am

Post by Amit_111 »

My date format is "19-SEP-08" in source table.
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Post by sachin1 »

OCONV(ICONV(ereplace("19-SEP-08","-"," "),"D2"),"D YMD[4,2,2]"), so when your input is "19-SEP-08" output is 2008 09 19, taking your oconv format into account.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The IConv mask must match the incoming date format. You've used "ICONV("Column_Name","D-MDY")" and shown a date example of "19-SEP-08". See the problem?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Amit_111
Participant
Posts: 134
Joined: Sat Mar 24, 2007 11:37 am

Post by Amit_111 »

Thanks Craig it working now. I used as follows:

OCONV(ICONV(ColumnName,"D DMY"),"D YMD[4,2,2]")
Post Reply