TIMESTAMP CONVERSION

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
sankar.td
Participant
Posts: 42
Joined: Fri Jul 25, 2008 3:53 am
Location: pune
Contact:

TIMESTAMP CONVERSION

Post by sankar.td »

Hi All,

I am trying to populate string data in to timestamp.
my source data format is YYMMDDHHMMSSSS ,
i need to populate this data in to target table having timestamp YY-MM-DD HH:MM:SS.
To Achive this output i have been using this function

"OCONV(ICONV(TRIM(INPUT_COLUMN[1,8]),"D4YMD[4,2,2]"), "D-YMD[4,2,2]") : " " : OCONV(ICONV(TRIM(INPUT_COLUMN[9,2]:":":INPUT_COLUMN[11,2]:":":INPUT_COLUMN[13,2]), "MTS"), "MTS")".

But data in target table populating as null !
Does i need to change my code?
nirdesh2
Participant
Posts: 56
Joined: Thu Nov 20, 2008 12:18 pm
Location: Noida

Re: TIMESTAMP CONVERSION

Post by nirdesh2 »

You can use the following function to convert the date into desired format DD[1,2]:'-':DD[3,2]:'-':DD[5,2]:' ': DD[7,2]: ':' :DD[9,2]: ':' :DD[11,2]

*Note: Smilies disabled in post - Content Editor*
Nirdesh Kumar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Someone needs to learn about 'Disable Smilies'. :wink:

Sankar - Dump the output from your timestamp conversion and check what you actually get from it. Hint: is your incoming year two or four digits?
-craig

"You can never have too many knives" -- Logan Nine Fingers
sankar.td
Participant
Posts: 42
Joined: Fri Jul 25, 2008 3:53 am
Location: pune
Contact:

Post by sankar.td »

HI Guys,

Thanks for your reponse.

chulet,

My incoming year is 2 digits only.
sa
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Right... and how many characters from the string are you substringing out for the date piece?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

Been a while since I player with Server but would "D4YMD[4,2,2]" say the delimiter is a "4"? Shouldn't it be DYMD[4,2,2]?

(Ignoring further posts identifying a two digit year... follow Craig Hulett's suggestion to figure out what should change)
sankar.td
Participant
Posts: 42
Joined: Fri Jul 25, 2008 3:53 am
Location: pune
Contact:

Post by sankar.td »

HI Chulet,



12 characters i need to substring.
I tried with following code also.

"OCONV(ICONV(TRIM(INPUT_COLUMN[1,6]),"D4YMD[4,2,2]"), "D-YMD[4,2,2]") : " " : OCONV(ICONV(TRIM(INPUT_COLUMN[7,2]:":":INPUT_COLUMN[9,2]:":":INPUT_COLUMN[11,2]), "MTS"), "MTS")".

But it is not working.
sa
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ICONV(TRIM(INPUT_COLUMN[1,6]),"D4YMD[4,2,2]") is one problem. Now you are pulling 6 but telling IConv it is 8 all together. And Kryt0n already pointed out your delimiter issue. Try this instead:

ICONV(INPUT_COLUMN[1,6],"DYMD[2,2,2]")
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Iconv() is clever enough not to need format information.

Code: Select all

Iconv(Left(InLink.TheString,6),"DYMD")
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