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 » How to subtract timestamps

Post new topic  Reply to topic
 How to subtract timestamps « View previous topic :: View next topic » 
Author Message
WBI_user
PostPosted: Thu Dec 13, 2001 9:52 pm    Post subject: Reply with quote

Partisan

Joined: 07 Aug 2001
Posts: 386

I am helping my customer to do MQSI performance measurement. They have a standard request/reply transaction (from PC to MVS/CICS back to PC). Two MQSI flow is involved with this backend CICS transaction.
The flow is:
Request flow
I/P->MQSI->MQ/MVS->CICS
Reply flow
CICS->MQ/MVS->MQSI->O/P

We are using MQSI 202 csd1, on NT.
We will take the timestamp in the first compute node after the I/P node and the time stamp in the last compute node before the O/P node and calculate the elapse time.
The time stamp taken at the input is carried as a XML field all the way to the output.

So in the first compute node just after the input we have

DECLARE T1 TIMESTAMP;
SET T1 = CURRENT_TIMESTAMP;
SET OutputRoot.XML.MSG.TIME_IN = T1;

This XML field will be in the message all the way until Output.

In the last compute node for the reply flow just before the MQOutput node we have

DECLARE T2 TIMESTAMP;
SET T2 = CURRENT_TIMESTAMP;
DECLARE T1 TIMESTAMP;
SET T1 = InputRoot.XML.MSG.TIME_IN;
SET OutputRoot.XML.MSG.TIME_OUT = T2;
SET OutputRoot.XML.MSG.TIME_ELAPSED = (T2-T1) SECOND;
MQSI nail me with a syntax error with the pointer between (T2-T1) and SECOND

If I remove SECOND, the syntax error goes away. But my flow will fail with
"When two datetime values are subtracted, an interval qualifier must be given."

According to mqsi V202 ESQL reference p.86
(CURRENT_TIME -TIME '00:00:00')MINUTE TO SECOND would return the age of the day in minutes and seconds.
I should be able to subtract two timestamps and MQSI should give me the difference in seconds (with my ESQL).
I cannot see anything that I did wrong here.
Can some one help ?

I have a second question here. I am not sure if InputRoot.XML.MSG.TIME_IN is still of datatype TIMESTAMP after it is inserted into a XML field. If not, the statement
SET OutputRoot.XML.MSG.TIME_ELAPSED = (T2-T1) SECOND; will not work because I don't think I can subtract a non timestamp datatype from a timestamp datatype.
Back to top
View user's profile Send private message
MVO
PostPosted: Fri Dec 14, 2001 7:27 am    Post subject: Reply with quote

Centurion

Joined: 09 Sep 2001
Posts: 131

Q1: You have to define a variable of type interval. Try this:
declare intsecs interval;
set intsecs=(T2 -T1) SECOND;
Yes, MQSI flags the statement as having a syntax error but it is a bug. The deployment should work fine.

By the way you don't have to declare 2 variables T1 and T2. You can get around it with the followings:
set intsecs=(CAST(CURRENT_TIMESTAMP AS TIMESTAMP)-InputRoot.XML.MSG.TIME_IN) SECOND;

Q2: Your InputRoot.XML.MSG.TIME_IN should still of datatype TIMESTAMP, I believe.
Back to top
View user's profile Send private message
WBI_user
PostPosted: Mon Dec 17, 2001 9:43 pm    Post subject: Reply with quote

Partisan

Joined: 07 Aug 2001
Posts: 386

Thanks, that works.
FYI, the data type of the time stamp in the incoming XML was changed. The trace says that I tried to subtract incompitable datatype. I think it got changed to CHAR. I have to CAST it to timestamp before the subtraction is successful.
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 » How to subtract timestamps
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.