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 » Search and delete specific fields in a unknown msg tree

Post new topic  Reply to topic
 Search and delete specific fields in a unknown msg tree « View previous topic :: View next topic » 
Author Message
venanciorb
PostPosted: Tue Jul 23, 2013 7:37 am    Post subject: Search and delete specific fields in a unknown msg tree Reply with quote

Newbie

Joined: 29 Aug 2011
Posts: 7

Hello!

I need to navigate in a unknown message tree and if I find some particular fields(fields like fill_*) I need to delete it.

I did a code to navegate in the message, but now I don't know how to delete the fields. See the code below:
Code:

      DECLARE pathFieldName CHARACTER;
            
      WHILE LASTMOVE(pathRef) DO

         WHILE LASTMOVE(pathRef) DO
   
            WHILE LASTMOVE(pathRef) DO
   
               SET pathFieldName = FIELDNAME(pathRef);
                  
               IF CONTAINS(pathFieldName, 'fill_') THEN

                  -- how to DELETE the FIELD ????

               END IF;
            
               MOVE pathRef FIRSTCHILD;
               
               IF LASTMOVE (pathRef) IS NOT TRUE THEN
                  
                  SET NOCHILD = 1;
                  
               END IF;   
         
               SET pathFieldName = FIELDNAME(pathRef);            
         
            END WHILE;
            
            MOVE pathRef NEXTSIBLING;
            
            IF (LASTMOVE (pathRef) IS NOT TRUE) AND (NOCHILD = 1) THEN
                  
               MOVE pathRef PARENT;
               MOVE pathRef NEXTSIBLING;
                  
            END IF;   
            
            SET NOCHILD =0;
                     
            SET pathFieldName = FIELDNAME(pathRef);         

      END WHILE;
      
      MOVE pathRef NEXTSIBLING;

   END WHILE;



I'll really appreciate any help.

Thanks. Roger
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Tue Jul 23, 2013 7:44 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Hi Roger - DETACH or DELETE keywords in ESQL would be a good place to start looking in the InfoCentre. Use Google.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
dogorsy
PostPosted: Tue Jul 23, 2013 8:10 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

if you look in the infocenter, create procedure statement, there is Example 2 that gives you a nice recursive procedure to navigate a tree, instead of the code posted above.
Back to top
View user's profile Send private message
venanciorb
PostPosted: Tue Jul 23, 2013 12:37 pm    Post subject: Solved Reply with quote

Newbie

Joined: 29 Aug 2011
Posts: 7

I deleted the fields using:

DELETE FIELD outRef.{Environment.grupoName}.{pathFieldName};

See completed code bellow.

Code:
   CREATE PROCEDURE RemoveFillers(IN pathRef REFERENCE) BEGIN
      
      DECLARE NS_S Char Environment.Variables.NAMESPACE;
      DECLARE saida namespace NS_S;
      DECLARE outRef REFERENCE TO OutputRoot.XMLNSC.saida:SERVICO_SAIDA.DADOS.RETORNO;

      DECLARE NOCHILD INTEGER 0;
      
      DECLARE pathFieldName CHARACTER;
      SET Environment.grupoName = '';
      SET Environment.DELETAR = 0;
            
      WHILE LASTMOVE(pathRef) DO

         WHILE LASTMOVE(pathRef) DO
   
            WHILE LASTMOVE(pathRef) DO
   
               SET pathFieldName = FIELDNAME(pathRef);
                  
               IF CONTAINS(pathFieldName, 'fill_') THEN

                  SET Environment.DELETAR = 1;
                  
                  DECLARE pathRef2 REFERENCE TO pathRef;
               
                  MOVE pathRef2 PARENT;

                  SET Environment.grupoName = FIELDNAME(pathRef2);                  
                  
                  
               END IF;
            
               MOVE pathRef FIRSTCHILD;
               
               IF LASTMOVE (pathRef) IS NOT TRUE THEN
                  
                  SET NOCHILD = 1;
                  
               END IF;   
         
               SET pathFieldName = FIELDNAME(pathRef);            
         
            END WHILE;
            
            MOVE pathRef NEXTSIBLING;
            
            IF (LASTMOVE (pathRef) IS NOT TRUE) AND (NOCHILD = 1) THEN
                  
               MOVE pathRef PARENT;
               MOVE pathRef NEXTSIBLING;
                  
            END IF;   
            
            IF Environment.DELETAR = 1 THEN
            
               IF Environment.grupoName = 'RETORNO' THEN
                  DELETE FIELD outRef.{pathFieldName};
               ELSE
                  DELETE FIELD outRef.{Environment.grupoName}.{pathFieldName};
               END IF;

            END IF;
            
            SET Environment.DELETAR = 0;
            
            SET NOCHILD =0;
                     
            SET pathFieldName = FIELDNAME(pathRef);         

      END WHILE;
      
      MOVE pathRef NEXTSIBLING;

   END WHILE;


Thanks everyone ...
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 » Search and delete specific fields in a unknown msg 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.