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
-
vinothkumar
- Participant
- Posts: 342
- Joined: Tue Nov 04, 2008 10:38 am
- Location: Chennai, India
Post
by vinothkumar »
Try this :
OConv(IConv(StageVar1[1,2]:'/':StageVar1[3,2]:'/':StageVar1[5,4], "D2/"),"D4/")
Where StageVar1 is your date '19991231'
-
vinothkumar
- Participant
- Posts: 342
- Joined: Tue Nov 04, 2008 10:38 am
- Location: Chennai, India
Post
by vinothkumar »
Sorry the date should be MMDDYYYY format
-
svhari76
- Participant
- Posts: 48
- Joined: Tue Nov 16, 2010 5:04 pm
Post
by svhari76 »
My input date is 11302009
and tried your suggestion above and getting NULL as return
Hari
-
vinothkumar
- Participant
- Posts: 342
- Joined: Tue Nov 04, 2008 10:38 am
- Location: Chennai, India
Post
by vinothkumar »
What's your target datatype. It should be a DATE.
-
gateleys
- Premium Member
- Posts: 992
- Joined: Mon Aug 08, 2005 5:08 pm
- Location: USA
Post
by gateleys »
svhari76 wrote:Hi
How can i convert String MMDDYYYY to Db2 date MM/DD/YYYY ?
Eg: '11302009' to be 11/30/2009
Try-
Code: Select all
Oconv(Iconv(InLink.YourDate, "DMDY[2,2,4]"), "D/MDY[2,2,4]")
gateleys
-
chulett
- Charter Member
- Posts: 43085
- Joined: Tue Nov 12, 2002 4:34 pm
- Location: Denver, CO
Post
by chulett »
I seem to recall the DB2 stage wanting dates in internal format...
-craig
"You can never have too many knives" -- Logan Nine Fingers
-
svhari76
- Participant
- Posts: 48
- Joined: Tue Nov 16, 2010 5:04 pm
Post
by svhari76 »
I Tried this and still gets the NULL.
Oconv(Iconv(Input.LCL_DPTR_DTE, "DMDY[2,2,4]"), "D/MDY[2,2,4]")
Hari
-
ray.wurlod
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
-
Contact:
Post
by ray.wurlod »
Leave off the Oconv() function. DB2 stage wants internal format.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.