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 » Anonymous Field Reference in ESQL

Post new topic  Reply to topic
 Anonymous Field Reference in ESQL « View previous topic :: View next topic » 
Author Message
dev
PostPosted: Thu Mar 28, 2002 11:34 am    Post subject: Reply with quote

Apprentice

Joined: 11 Oct 2001
Posts: 30

I have various XML messages comming in with similar structure but Root element, lets say messages are:

Msg 1:
<?xml version="1.0" encoding="UTF-8"?>
<AAA>
<Header>
<Topic></Topic>
<MessageSequence></MessageSequence>
</Header>
</AAA>

Msg 2:
<?xml version="1.0" encoding="UTF-8"?>
<BBB>
<Header>
<Topic></Topic>
<MessageSequence></MessageSequence>
</Header>
</BBB>
.
.
.
.
Msg n:
<?xml version="1.0" encoding="UTF-8"?>
<NNN>
<Header>
<Topic></Topic>
<MessageSequence></MessageSequence>
</Header>
</NNN>

While sending message out in Compute node I write for root element AAA:
SET "OutputRoot"."XML"."AAA"."Header"."Topic" = "InputBody"."AAA"."Header"."MessageSequence";

or for root element NNN
SET "OutputRoot"."XML"."NNN"."Header"."Topic" = "InputBody"."NNN"."Header"."MessageSequence";

If I need to refer Root element of InputBody, so I can write one statement like:
SET "OutputRoot"."XML"."NNN"."Header"."Topic" = "InputBody".*[2]."Header"."MessageSequence";

Similar, if I need to refer Output message's root element what shoud I refer?

I want something like this but I know that syntactically wrong.

SET "OutputRoot"."XML".(FIELDNAME("InputBody".*[2]))."Header"."Topic" = "InputBody".*[2]."Header"."MessageSequence";

Any help?
Back to top
View user's profile Send private message
dev
PostPosted: Thu Mar 28, 2002 2:21 pm    Post subject: Reply with quote

Apprentice

Joined: 11 Oct 2001
Posts: 30

I got it working, solution is:
EVAL('SET "OutputRoot"."XML".' ||(FIELDNAME(InputBody.(XML.tag)[1]))|| '."Header"."Topic" = "InputBody".*[2]."Header"."MessageSequence";');

Thanks
Back to top
View user's profile Send private message
kirani
PostPosted: Thu Mar 28, 2002 2:48 pm    Post subject: Reply with quote

Jedi Knight

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

try this ...
DECLARE myroot CHAR;
SET myroot = FIELDNAME(InputBody.*[1]);
EVAL( 'SET OutputRoot.XML.' || myroot || '.Header.Topic = InputBody.*[1].Header.MessageSequence');

Back to top
View user's profile Send private message Visit poster's website
kolban
PostPosted: Fri Mar 29, 2002 9:04 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

I try and avoid EVAL wherever I can. It is too expensive for my taste. How about the following:
Code:

declare inputDocRef reference to InputRoot.XML.*[1];
create firstchild of OutputRoot.XML NAME fieldname(inputDocRef);
declare outputDocRef reference to OutputRoot.XML.*[1];
set outputDocRef.Header.Topic = inputDocRef.Header.MessageSequence;


For additional info on referencies, see http://www.mqseries.net/phpBB/viewtopic.php?topic=2045&forum=7&6
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 » Anonymous Field Reference in ESQL
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.