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 reorder the output message

Post new topic  Reply to topic
 How to reorder the output message « View previous topic :: View next topic » 
Author Message
hs
PostPosted: Thu Jul 21, 2005 1:17 am    Post subject: How to reorder the output message Reply with quote

Novice

Joined: 03 Jun 2005
Posts: 17

I would like to change the order of the fields when I produce the output message from the input.

I have an input message:

Code:
<General>
     <Messagetype>1 </Messagetype>
     <Reference>
           <Web>161565383 </Web>
           <Request>0000 </Request>
      </Reference>
      <Date>00000 </Date>
</General>


The output message should look like this:

Code:
<General>
     <Messagetype>1 </Messagetype>
     <Reason>
           <Status>0</Status>
     </Reason>
     <Reference>
           <Web>161565383 </Web>
           <Request>0000 </Request>
      </Reference>
      <Date>00000 </Date>
</General>


However, when I create the output message:


Code:
-- This needs to be done, as the input msg contains other fields,
   -- which are not shown in this example...
   SET OutputRoot = InputRoot;
   SET OutputRoot.XML.General.Reason.Status='0';
   


ends up after :
<Date>0000</Date>


Can anyone suggest how I can put it in the correct order ?
_________________
IBM Certified System Administrator - WebSphere MQ V5.3
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Thu Jul 21, 2005 2:05 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

If you want it to come before the reference you got to SET it before the reference.

In other words, dont use InputRoot = OutputRoot....
Back to top
View user's profile Send private message Send e-mail
mgk
PostPosted: Thu Jul 21, 2005 2:13 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Look up the CREATE FIELD statement it gives you control over where elements are created.

Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
hs
PostPosted: Thu Jul 21, 2005 3:52 am    Post subject: Reply with quote

Novice

Joined: 03 Jun 2005
Posts: 17

I have managed to figure out how to reorder the output msg...

Code:
[size=9]CREATE FIELD OutputRoot.XML.General;
       CREATE FIRSTCHILD OF OutputRoot.XML.General NAME 'Messagetype' VALUE InputRoot.XML.General.Messagetype;
      
       CREATE LASTCHILD OF OutputRoot.XML.General NAME 'Reason';
       CREATE FIELD OutputRoot.XML.General.Reason.Status VALUE '0';
             
       CREATE LASTCHILD OF OutputRoot.XML.General NAME 'Reference';
       CREATE FIELD OutputRoot.XML.General.Reference.Web VALUE InputRoot.XML.General.Reference.Web;
       CREATE FIELD OutputRoot.XML.General.Reference.Request VALUE InputRoot.XML.General.Reference.Request;
      
       CREATE LASTCHILD OF OutputRoot.XML.General NAME 'Date' VALUE InputRoot.XML.General.Date;[/size]
[/code]

Thanks for everyone's input. :
_________________
IBM Certified System Administrator - WebSphere MQ V5.3
Back to top
View user's profile Send private message
javaforvivek
PostPosted: Fri Jul 22, 2005 2:50 am    Post subject: Reply with quote

Master

Joined: 14 Jun 2002
Posts: 282
Location: Pune,India

hsalim,
Instead of creating all the elements once again for the output root, you can try this:
Code:

SET OutputRoot = InputRoot;
      CREATE LASTCHILD OF OutputRoot.XML.General NAME 'Reason';
          CREATE FIELD OutputRoot.XML.General.Reason.Status VALUE '0';
      DECLARE outputRef REFERENCE TO OutputRoot.XML.General.Reason;
      DETACH outputRef;
      ATTACH outputRef TO OutputRoot.XML.General.Messagetype AS NEXTSIBLING;


mgk,
I think that this will give better performance than hsalim's code. What do you think?
_________________
Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
hs
PostPosted: Mon Jul 25, 2005 1:13 am    Post subject: Reply with quote

Novice

Joined: 03 Jun 2005
Posts: 17

Thanks Vivek,

That worked !
_________________
IBM Certified System Administrator - WebSphere MQ V5.3
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 reorder the output message
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.