Comparing timestamps in a PX job

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Rajesh_kr82
Participant
Posts: 24
Joined: Sat Oct 15, 2005 1:09 pm

Comparing timestamps in a PX job

Post by Rajesh_kr82 »

I have two timestamps and i want to compare them in a PX job. I think there is no inbuilt routine for this kind of comparison. Has any one implemented this, if yes then can i have the code and the steps to use it?

Rajesh
Regards,
Rajesh
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Rajesh,

start at Page B-1 of the Parallel Job Developer's Guide and look at the various date functions. Convert your two dates into numeric values using any one of the methods and you have a method of comparing them.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

And here is one

Code: Select all

SecondsSinceFromTimestamp
Returns the number of seconds between two timestamps in seconds.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Is it not possible to compare two timestamps directly? Since they are of the same data type, surely any comparison operator will return a true/false result?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
nvuradi
Participant
Posts: 54
Joined: Tue Dec 12, 2006 11:03 pm

Post by nvuradi »

kumar_s wrote:And here is one

Code: Select all

SecondsSinceFromTimestamp
Returns the number of seconds between two timestamps in seconds.
Hi I have used this in My job but this function is returning 0 always. i used a stage variable with Integer 1 to capture the result.

can let me know how to get the proper difference between 2 timestamps?

Thanks
Naren
dh_Madhu
Premium Member
Premium Member
Posts: 65
Joined: Sat Apr 23, 2005 3:19 am
Location: Stirling, Scotland

Post by dh_Madhu »

Well, Recently I prefered handling it in the sql itself to query a database with 1 million records (and growing...) :)
Regards,
Madhu Dharmapuri
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Re: Comparing timestamps in a PX job

Post by JoshGeorge »

As noted, you can compare dates or timestamps directly.
Date1=Date2

or

Timestamp1=Timestamp2

If they are different you will get the Status:0
If they are same you will get the Status:1
Rajesh_kr82 wrote:I have two timestamps and i want to compare them in a PX job.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
Post Reply