Comparing two timestamp fields in transformer

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
devsonali
Premium Member
Premium Member
Posts: 155
Joined: Sun Mar 18, 2007 2:31 pm

Comparing two timestamp fields in transformer

Post by devsonali »

Hello Gurus
I am trying to compare two timestamp fields in a stage variable,
in.timestampfield < lkp.timestamp field ?

When I do a comparisons directly by above condition i am not seeing the desired result
I tried to search the forum with the key word "compare timestamp"
but could nt see any post addressing my issue

Any pointers ?

Thanks
devsonali
Premium Member
Premium Member
Posts: 155
Joined: Sun Mar 18, 2007 2:31 pm

Post by devsonali »

Missed the timestamp format
Here is what both timestamps look like
eg
YYYY-MM-DD HH:MM:SS
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That external format should compare just fine. Can you provide your exact syntax, input values and output?
-craig

"You can never have too many knives" -- Logan Nine Fingers
devsonali
Premium Member
Premium Member
Posts: 155
Joined: Sun Mar 18, 2007 2:31 pm

Post by devsonali »

Hopefully i am understanding your question correctly

I have an input.timestamp field which i am comparing with a lookup.timestamp field
Both are having the same format
'YYYY-MM-DD HH24:MI:SS'

both the fields are pulled up by converting into char
TO_CHAR(inputtimestampfield, 'YYYY-MM-DD HH24:MI:SS'),
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Cool. Then they can be compared with comparison operators, for example

Code: Select all

InLink.Timestamp1 = InLink.Timestamp2
The ISO8601 format (which uses a 24 hour clock) for timestamps sorts and compares correctly when the timestamp is represented as a string.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Meaning they should compare just fine. :wink:

What issue are you seeing? What makes you think that isn't happening properly? Can you provide some specific examples?
-craig

"You can never have too many knives" -- Logan Nine Fingers
devsonali
Premium Member
Premium Member
Posts: 155
Joined: Sun Mar 18, 2007 2:31 pm

Post by devsonali »

Ray/Creig

You are right, I had a wrong value in one of my query through which i was testing the result set

Sorry to waste your time
This works just fine

Marking it resolved
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No worries! :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply