iconv/oconv routine for date conversion fails in v8

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
sjordery
Premium Member
Premium Member
Posts: 202
Joined: Thu Jun 08, 2006 5:58 am

iconv/oconv routine for date conversion fails in v8

Post by sjordery »

Hi All,

I have a BASIC routine that was working happily on our old v7.5 instance on DataStage. It looks like this:

Code: Select all

WorkDate = Iconv(InputDate,"D/E")
Ans = oconv(WorkDate, "D/MDY[2,2,4]")
Basically, it takes input date in the UK accepted standard format and converts to the US format.

The routine when tested stand-alone is returning correct results all the time:

Eg. 02/01/2008 ---> 01/02/2008

However, when I call the routine from within the (server) job in v8.01, it works for:

01/02/1998 ---> 02/01/1998

But fails for:

30/01/2008 ---> Blanks
23/09/2005 ---> Blanks

The calling job is unchanged, it was exported working from 7.5 and now behaves like this in v8.01 after import.

Any suggestions appreciated.

Thanks
S
sjordery
Premium Member
Premium Member
Posts: 202
Joined: Thu Jun 08, 2006 5:58 am

Post by sjordery »

Got it! :)

We didn't used to have NLS installed on the old server, but have it with v8.01. The default date under this option was set as US-ENGLISH.

Changed to GB-ENGLISH and it now works. I will change the routine to explicitly expect input date of DD/MM/YYYY.

Hope this helps someone else at some point.

Cheers,
S
mikegohl
Premium Member
Premium Member
Posts: 97
Joined: Fri Jun 13, 2003 12:50 pm
Location: Chicago
Contact:

Post by mikegohl »

This worked for me on 8:

WorkDate = Iconv(InputDate,"D/DMY[2,2,4]")
Ans = oconv(WorkDate, "D/MDY[2,2,4]")
Michael Gohl
sjordery
Premium Member
Premium Member
Posts: 202
Joined: Thu Jun 08, 2006 5:58 am

Post by sjordery »

Perfect - thanks Mike.

Cheers,
S
Post Reply