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 » Navigation of Message Tree

Post new topic  Reply to topic
 Navigation of Message Tree « View previous topic :: View next topic » 
Author Message
Heidils
PostPosted: Wed Jul 30, 2003 5:50 am    Post subject: Navigation of Message Tree Reply with quote

Novice

Joined: 25 May 2003
Posts: 11
Location: SA

Hi,

We need to navigate through a message tree and find a specific tag. However this tag could come in on any level as we are dealing with different 3rd parties(therefore different message sets) and need to accomodate them all.

We have looked at the nextchild / nextsibling option but being fairly new at this game aren't sure if this would solve the problem or how to use this exactly.

Is there a quick or different way of solving this problem ???

Thanks...
Back to top
View user's profile Send private message
kirani
PostPosted: Wed Jul 30, 2003 11:17 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

If you just want to find out whether the tag exist or not, then I think the following code will work for you,
First, read your input message as BLOB in MQInput node. In a compute node use CAST ... CCSID function to convert this to a CHAR string. Use POSITION function to search for the TAG name into input message.
_________________
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
View user's profile Send private message Visit poster's website
Heidils
PostPosted: Wed Jul 30, 2003 9:43 pm    Post subject: Reply with quote

Novice

Joined: 25 May 2003
Posts: 11
Location: SA

Thanks Kirani - we'll defenitly give this a go.. !
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Jul 31, 2003 6:01 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You should also be able to use a Select statement on the message tree to find the tag you want. And it may be more efficient than a string search.
Back to top
View user's profile Send private message
marior
PostPosted: Fri Aug 01, 2003 3:29 am    Post subject: Reply with quote

Newbie

Joined: 05 Jun 2003
Posts: 4

Heidils actually posted this problem on the forum for me. I am getting this problem because I am allowing various different Message Sets, with different layouts, through this one flow.

From the examples I've seen, when using a select you still have to know at what level you are searching for the field. I'm not sure if you can select a field on the 5th level from root?

The string search will work to determine if the field is there, but I need to return the full path of the field after finding it.

The only solutions I foresee is to write a function that loops through the message structure, or standardise the layout, or use attributes on the root tag instead of this specific field.
Back to top
View user's profile Send private message
Craig B
PostPosted: Fri Aug 01, 2003 4:22 am    Post subject: Reply with quote

Partisan

Joined: 18 Jun 2003
Posts: 316
Location: UK

Hi,

Just so you can consider all the different ways of doing this, the following can be used to navigate a message tree to any depth and search for a field name with a specific value. It shouldn't take too much to tailor this to your needs :

Code:

DECLARE foundMatch BOOLEAN FALSE;
CALL navigate (ExceptionList,  foundMatch, 'myFieldName', 'Value I am looking for');
RETURN foundMatch;

CREATE PROCEDURE navigate (IN root REFERENCE, INOUT foundMatch BOOLEAN, IN searchField CHAR, IN searchText CHAR)
BEGIN
   DECLARE LookFor CHARACTER;
   DECLARE MatchingPattern CHARACTER;
   DECLARE cursor REFERENCE TO root;
   SET MatchingPattern = FIELDNAME(root);
   MOVE cursor FIRSTCHILD;
   IF LASTMOVE(cursor) THEN
   ELSE
      IF MatchingPattern = searchField THEN
        IF CAST(root AS CHARACTER) = searchText THEN
           SET foundMatch = TRUE;
        END IF;
      END IF;
   END IF;
   WHILE LASTMOVE(cursor) AND (foundMatch = FALSE) DO
       CALL navigate(cursor, foundMatch, searchField, searchText);
       MOVE cursor NEXTSIBLING;
   END WHILE;
END;


This code was written for the filter node to search for errors in the Exception List. This same code will work in a compute node, but obviously the tree names will be OutputRoot or InputRoot etc, and you do not need the RETURN statement at the end.

Obviously this uses recursion, and therefore for big trees, could cause a large number of lines of ESQL, so you should consider this before possibly using it.

Hope this helps.
_________________
Regards
Craig
Back to top
View user's profile Send private message
marior
PostPosted: Fri Aug 01, 2003 4:49 am    Post subject: Reply with quote

Newbie

Joined: 05 Jun 2003
Posts: 4

That looks great! Thanks for the help Craig.
Back to top
View user's profile Send private message
dsmq
PostPosted: Mon Aug 04, 2003 8:12 am    Post subject: Reply with quote

Acolyte

Joined: 20 Jun 2002
Posts: 59

Hi

I am Having the same problem

I have 4 different XML schemas , all are going to the same message flow.

Here i want do a standard layout for all schemas and then i need to do the XML to MRM trandformation.

How i do the standard layout . Can anybody Help me in this.

Thanks
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 » Navigation of Message Tree
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.