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 » PROPAGATE question

Post new topic  Reply to topic
 PROPAGATE question « View previous topic :: View next topic » 
Author Message
RichA
PostPosted: Wed Jun 04, 2003 2:54 am    Post subject: PROPAGATE question Reply with quote

Centurion

Joined: 14 Mar 2002
Posts: 102

I'm trying to loop through an XML node and propagate for each sibling there is of a particular type, here is some very simplified code -

SET Environment.Variables.Body = InputRoot.XML;
DECLARE C INTEGER;
SET C = CARDINALITY(InputRoot.*[]);
DECLARE I INTEGER;
DECLARE transaction REFERENCE TO Environment.Variables.Body.transaction[1];
WHILE LASTMOVE(transaction) DO
SET I = 1;
WHILE I < C DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
SET OutputRoot.Properties.MessageSet = 'DT12H4C07K001';
SET OutputRoot.Properties.MessageType = 'transaction';
SET OutputRoot.Properties.MessageDomain = 'MRM';
SET OutputRoot.Properties.MessageFormat = 'CWF';
SET "OutputRoot"."MRM"."transId" = CAST(transaction.id AS INTEGER);
SET "OutputRoot"."MRM"."transInfo" = transaction.info;
SET "OutputRoot"."MRM"."transMoreInfo" = transaction.moreinfo;
PROPAGATE;
MOVE transaction NEXTSIBLING;
END WHILE;

This works up to the point where it has moved through all the transaction elements, there is then one final message spawned, I'm assuming this is from it dropping out the end of the compute esql. Is there a way to prevent this message occuring, or am I going to have to handle it in some way, by populating it and sending it to a queue where it can be junked or something?
Back to top
View user's profile Send private message MSN Messenger
whiting
PostPosted: Wed Jun 04, 2003 3:54 am    Post subject: Reply with quote

Acolyte

Joined: 26 Mar 2002
Posts: 64
Location: Greenville, SC

The last message is from dropping out of the loop. Handle it by testing for the end of the list at the bottom of the loop so that you finish the compute node with the last transaction in OutputRoot.

//Bill
Back to top
View user's profile Send private message Send e-mail
RichA
PostPosted: Wed Jun 04, 2003 4:50 am    Post subject: Reply with quote

Centurion

Joined: 14 Mar 2002
Posts: 102

What is the mechanism for doing this in ESQL?, I've tried looking through the ESQL reference, but cannot find the looping mechanism where the predicate appears at the end of the loop rather than the beginning. The only way I can see round this so far is using the cardinality, I did read this was innefficent when being used in a loop though, and this propagate loop is nested within two other while loops so the cardinality function would be getting called quite lot, something I wanted to avoid, but I'm not sure I can.
Back to top
View user's profile Send private message MSN Messenger
whiting
PostPosted: Wed Jun 04, 2003 5:08 am    Post subject: W Reply with quote

Acolyte

Joined: 26 Mar 2002
Posts: 64
Location: Greenville, SC

If you want to use cardinality, then save the value in a variable and use that.
i.e.
define tran_count integer;
define ix integer
set tran_count=cardinality(Environment.Variables.Body.transaction)
ix=1
while ix < tran_count do
....

or
change the end of your loop to

MOVE transaction NEXTSIBLING;
IF LASTMOVE(transaction) THEN
PROPAGATE;
END IF;
END WHILE;

//Bill
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Wed Jun 04, 2003 6:30 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Don't forget that the normal action of a compute node finishing execution is to propogate the current OutputRoot to the out terminal - regardless of the ESQL code that's been executed up to that point.

If you want prevent this behaviour, you need to use
Code:
return false;
at the end of your ESQL.

So add that after your end while, and you should be okay.
Back to top
View user's profile Send private message
RichA
PostPosted: Wed Jun 04, 2003 7:49 am    Post subject: Reply with quote

Centurion

Joined: 14 Mar 2002
Posts: 102

Ah, that's got it, thanks for that one.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

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