ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Get TIMESTAMP Difference

Post new topic  Reply to topic
 Get TIMESTAMP Difference « View previous topic :: View next topic » 
Author Message
vincentDE
PostPosted: Fri May 24, 2013 3:03 am    Post subject: Get TIMESTAMP Difference Reply with quote

Newbie

Joined: 24 May 2013
Posts: 1

Hello,

Im using the following code:

Code:
CREATE COMPUTE MODULE ProcessStateInfo
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      -- CALL CopyMessageHeaders();
      -- CALL CopyEntireMessage();
      DECLARE currentTimestamp TIMESTAMP CURRENT_TIMESTAMP;
      DECLARE oldtime TIMESTAMP;
      DECLARE diff INTERVAL;
      
      SET oldtime = CAST('2013-05-21 09:15:30.291' AS TIMESTAMP);
      SET diff = (currentTimestamp - oldtime) DAY TO HOUR;
      
      RETURN TRUE;
   END;


My Problem is that "diff" has no value. One other forum user here had a same problem years ago.

viewtopic.php?t=51172&sid=68eaac55e03f9f48d617677b04224779

I did not find any solution. Can you help me?

Best Regards,

Vincent
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri May 24, 2013 4:28 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You need to specify a FORMAT for the CAST.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Fri May 24, 2013 4:33 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Trivia: TIMESTAMP values collected in the same Compute node will have the same value. When you want to measure the time it takes ESQL to accomplish a particular task, you need two Compute nodes, the first to get the current time and accomplish the work, the second to get the current time after the work was accomplished and to calculate the difference between start and finish.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Fri May 24, 2013 4:38 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

lancelotlinc wrote:
Trivia: TIMESTAMP values collected in the same Compute node will have the same value. When you want to measure the time it takes ESQL to accomplish a particular task, you need two Compute nodes, the first to get the current time and accomplish the work, the second to get the current time after the work was accomplished and to calculate the difference between start and finish.


I'm not sure that's accurate. Perhaps it's changed in v8, but it used to be that calling CURRENT_TIMESTAMP returned the same value at all places within the same message flow instance.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Fri May 24, 2013 4:56 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

mqjeff wrote:
lancelotlinc wrote:
Trivia: TIMESTAMP values collected in the same Compute node will have the same value. When you want to measure the time it takes ESQL to accomplish a particular task, you need two Compute nodes, the first to get the current time and accomplish the work, the second to get the current time after the work was accomplished and to calculate the difference between start and finish.


I'm not sure that's accurate. Perhaps it's changed in v8, but it used to be that calling CURRENT_TIMESTAMP returned the same value at all places within the same message flow instance.


I know for V7 and V8, the current time is scoped to Compute node only. Two Compute nodes in the same message flow will return two different time values. You may be correct for V6.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Fri May 24, 2013 5:00 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

lancelotlinc wrote:
I know for V7 and V8, the current time is scoped to Compute node only. Two Compute nodes in the same message flow will return two different time values. You may be correct for V6.


For the record and the benefit of future readers, see here

Quote:
All calls to CURRENT_TIMESTAMP within the processing of one node are guaranteed to return the same value

_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
dogorsy
PostPosted: Fri May 24, 2013 8:32 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

lancelotlinc wrote:
mqjeff wrote:
lancelotlinc wrote:
Trivia: TIMESTAMP values collected in the same Compute node will have the same value. When you want to measure the time it takes ESQL to accomplish a particular task, you need two Compute nodes, the first to get the current time and accomplish the work, the second to get the current time after the work was accomplished and to calculate the difference between start and finish.


I'm not sure that's accurate. Perhaps it's changed in v8, but it used to be that calling CURRENT_TIMESTAMP returned the same value at all places within the same message flow instance.


I know for V7 and V8, the current time is scoped to Compute node only. Two Compute nodes in the same message flow will return two different time values. You may be correct for V6.


it is better to invoke from the same compute node a simple java pgm that returns the time and then calculate the difference.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Fri May 24, 2013 9:14 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

dogorsy wrote:
lancelotlinc wrote:
mqjeff wrote:
lancelotlinc wrote:
Trivia: TIMESTAMP values collected in the same Compute node will have the same value. When you want to measure the time it takes ESQL to accomplish a particular task, you need two Compute nodes, the first to get the current time and accomplish the work, the second to get the current time after the work was accomplished and to calculate the difference between start and finish.


I'm not sure that's accurate. Perhaps it's changed in v8, but it used to be that calling CURRENT_TIMESTAMP returned the same value at all places within the same message flow instance.


I know for V7 and V8, the current time is scoped to Compute node only. Two Compute nodes in the same message flow will return two different time values. You may be correct for V6.


it is better to invoke from the same compute node a simple java pgm that returns the time and then calculate the difference.


Not !!

http://www.mqseries.net/phpBB2/viewtopic.php?p=348393&sid=af7624474dc93ebd82d65d4c5d7b062f
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Get TIMESTAMP Difference
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.