Timestamp comparision

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
ravitell1
Participant
Posts: 12
Joined: Wed Aug 11, 2010 12:28 pm

Timestamp comparision

Post by ravitell1 »

Hello all,

I have a timestamp coming as" 2008-10-21 13:14:44.997187"

need to check that 2008 is numeric or not...


Please help me..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why not just use the IsValid function and see if it is a valid timestamp or not. Ah... Server... Ray Wurlod has a Server version freely available from his website, from what I recall.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ravitell1
Participant
Posts: 12
Joined: Wed Aug 11, 2010 12:28 pm

Post by ravitell1 »

thanks for the speedy response..


Actually i need to convert the above timestamp format to mmddyyyy..
then i need to compare whether the yyyy is numeric or not...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

Left(Trim(InLink.TheTimestamp),4) Matches "4N"
will test for yyyy consisting of four numeric characters.

You can use a mix of Iconv() and Oconv() functions to change the format. Please advise your exact output format requirement.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ravitell1
Participant
Posts: 12
Joined: Wed Aug 11, 2010 12:28 pm

Post by ravitell1 »

how to convert the timestamp to date..
Need to convert "2008-10-21 13:14:44.997187" to the format MMDDYYYY
and then check whether yyyy is numeric or not...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What is your target? MMDDYYYY is not a DATE data type so you may in fact need something else, that or you may just need to substring off the date from the time.
-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 »

What do you want to do with the time component of the timestamp?

What is the data type of the target? Assuming it's a string of some kind, then one answer is

Code: Select all

Oconv(Iconv(Field(InLink.TheTimestamp, " ", 1, 1), "DYMD"), "DMDY[2,2,4]" : @VM : "MCN")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ravitell1
Participant
Posts: 12
Joined: Wed Aug 11, 2010 12:28 pm

Post by ravitell1 »

The Senario is i need to convert the timestamp to MMDDYYYY and check the YYYY is numeric or not
If numeric send MMDDYYYY else send space
... to a seqential file...which in turn used to load into warehouse..
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I have provided everything you need except the If..Then..Else construct.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ravitell1
Participant
Posts: 12
Joined: Wed Aug 11, 2010 12:28 pm

Post by ravitell1 »

ray.wurlod wrote:I have provided everything you need except the If..Then..Else construct. ...
Thanks it worked...
Post Reply