|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
date subtraction |
« View previous topic :: View next topic » |
Author |
Message
|
bindu |
Posted: Tue Oct 26, 2004 7:05 am Post subject: date subtraction |
|
|
Voyager
Joined: 07 May 2004 Posts: 97
|
Hi,
I got the most recent date by using select clause and max function. But i am unable to get the text for that particular date here i am posting code and also request message so advice me if i did any wrong or suggest some ..
request:
<Test><Field1><Value>2004-06-25</Value><Text>ma</Text></Field1><Field2><Value>2000-07-25</Value><Text>dh</Text></Field2><Field3><Value>2004-08-30</Value><Text>u</Text></Field3></Test>
Code:
DECLARE C INTEGER;
SET C = CARDINALITY(InputRoot.*[]);
DECLARE I INTEGER;
SET I = 1;
WHILE I < C DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
DECLARE DT DATE;
DECLARE DT1 CHARACTER;
DECLARE DT2 CHARACTER;
DECLARE MSG CHARACTER;
DECLARE i INTEGER;
SET DT = (SELECT MAX(myRef."Value") FROM InputRoot.XML.Test.*[] AS myRef);
SET OutputRoot.XML."xml"."DATE"=DT;
SET i=1;
WHILE(i<= CARDINALITY(InputRoot.XML."Test"."Field"[])) DO
SET DT1 = CAST(InputRoot.XML."Test"."Field"[i]."Value" AS CHARACTER);
SET DT2= CAST(DT AS CHARACTER);
IF(DT1 = DT2) THEN
SET MSG=InputRoot.XML."Test"."Field"[i]."Text";
SET OutputRoot.XML."xml"."VALUE"=MSG;
END IF;
SET i=i+1;
END WHILE;
Any suggestions,
Thanx,
Bindu |
|
Back to top |
|
 |
kirani |
Posted: Tue Oct 26, 2004 5:36 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
I think you got the tag names wrong. In some places you are referring to it as Field1...Fieldn and in some places you are referring to it as Field[].
I think, once you fix the input message then it will work fine. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
bindu |
Posted: Wed Oct 27, 2004 7:04 am Post subject: date subtraction resolved |
|
|
Voyager
Joined: 07 May 2004 Posts: 97
|
Hi Kiran,
Thanq You very much ....its resoved i am able to getting data.
Thanx for ur time.
Thanx,
Bindu |
|
Back to top |
|
 |
|
|
|
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
|
|
|
|