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 » Subtract Timestamp interval

Post new topic  Reply to topic
 Subtract Timestamp interval « View previous topic :: View next topic » 
Author Message
Lo
PostPosted: Sat Nov 12, 2005 11:17 am    Post subject: Subtract Timestamp interval Reply with quote

Novice

Joined: 14 Feb 2005
Posts: 21

Folks,

Can anyone tell me what is wrong in this statement , i cannot get an interval into Processtime

I can see tsTmp1 and tsTmp2 in the debug with valid timestamp values. Yet when i subtract , ProcessTime is not set to any thing.

One more thing the IF test always returns a false, shouldnt this throw an exception is ProcessTime is NULL?

DECLARE tsTmp1 TIMESTAMP;
DECLARE tsTmp2 TIMESTAMP;
DECLARE ProcessTime INTERVAL;
DECLARE Seconds INTERVAL;

SET tsTmp1 = CURRENT_TIMESTAMP;
SET tsTmp2 = CAST(Environment.Variables.Timer.Start AS TIMESTAMP);
SET ProcessTime = (tsTmp1 - tsTmp2) SECOND;
SET Seconds = INTERVAL '10' SECOND;

IF( ProcessTime > Seconds ) THEN
SET EXPIRED = TRUE;
END IF;

Thanks
Code:
Back to top
View user's profile Send private message
JT
PostPosted: Mon Nov 14, 2005 8:51 am    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

Did you forget something ?

Quote:
SET ProcessTime = INTERVAL (tsTmp1 - tsTmp2) SECOND;

Quote:
One more thing the IF test always returns a false, shouldnt this throw an exception is ProcessTime is NULL?

No, when comparing values, if any of the operands is NULL, then the result is UNKNOWN, and an UNKNOWN condition, on a comparision, is treated the same as FALSE.
Back to top
View user's profile Send private message
EddieA
PostPosted: Mon Nov 14, 2005 9:29 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

JT wrote:
Did you forget something ?

Quote:
SET ProcessTime = INTERVAL (tsTmp1 - tsTmp2) SECOND;

Not according to the manual.
Quote:
Declare PutTime INTERVAL;
SET PutTime = (CURRENT_GMTTIME - InputRoot.MQMD.PutTime) MINUTE TO SECOND;

And
Quote:
Subtracting a (GMT)TIME value from a (GMT)TIME value, a DATE value from a DATE value, or a (GMT)TIMESTAMP value from a (GMT)TIMESTAMP value, results in an INTERVAL value representing the time interval between the two operands.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Lo
PostPosted: Tue Nov 15, 2005 10:34 pm    Post subject: Reply with quote

Novice

Joined: 14 Feb 2005
Posts: 21

Actually the interval did exist but my debugger was not showing it.
I just converted the Interval to an Integer.

SET SecondsInt = CAST(Seconds AS INTEGER);

SecondsInt gave me the proper value.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Subtract Timestamp interval
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.