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 » Java Equivalent of SET OutputRoot.MQRFH2.usr = null;

Post new topic  Reply to topic
 Java Equivalent of SET OutputRoot.MQRFH2.usr = null; « View previous topic :: View next topic » 
Author Message
christian witschel
PostPosted: Sat Sep 15, 2007 12:39 am    Post subject: Java Equivalent of SET OutputRoot.MQRFH2.usr = null; Reply with quote

Apprentice

Joined: 07 Dec 2005
Posts: 27

Hi,

I am looking for the java equivalent of removing a complete part of the logical tree.

in ESQL
SET OutputRoot.MQRFH2.usr = null;
sets usr to null and also removes any children of usr from the tree.

in Java I can do:
refOutput.getFirstElementByPath("/MQRFH2/usr").setValue(null);
but the children remain.

Please do not tell me that to this I need to create a new message and filter out this part of the tree. I also tried googling and searching this forum with no luck.

thanks for your help.
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Sat Sep 15, 2007 3:42 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

setValue(null) is equivalent to the ESQL
Set ... VALUE = null

And both do exactly what you say - leave the element intact in the tree.

You can detach the MbElement you want. I think you can also just set the MbElement itself to NULL. Either way you need to get a reference to it first as a separate variable

MbElement deleteMe = refOutput.getFirstElementByPath("/MQRFH2/usr");

deleteMe.detach()

or
deleteMe= null;

(not as sure that the later will work).
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
christian witschel
PostPosted: Sat Sep 15, 2007 5:19 am    Post subject: Reply with quote

Apprentice

Joined: 07 Dec 2005
Posts: 27

sorry dude,

I just debugged again and found that

Before:

MQRFH2
Version = 2
Format = MQSTR
Encoding = 273
CodedCharSetId = 1208
Flags = 0
NameValueCCSID = 1208
mcd
Type
Msd
Set
Fmt
jms
Dst
Rto
usr
hostdate
hosttime
file
boname
bocount
ControlData
MRM



SET OutputRoot.MQRFH2.usr = null;


After :

MQRFH2
Version = 2
Format = MQSTR
Encoding = 273
CodedCharSetId = 1208
Flags = 0
NameValueCCSID = 1208
mcd
Type
Msd
Set
Fmt
jms
Dst
Rto
MRM

So this line actually does remove all children of usr as well. The java couterpart does not. why?
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Sat Sep 15, 2007 5:52 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Under the covers, ESQL probably does a few more things when you assign a tree element to NULL.

If you use .detach(), that will remove the element (and consequently all of it's children) from the tree.

It was just a guess, that I wasn't sure would work, that assigning it to NULL in Java would be the equivalent. You could probably achieve the same thing as detach() if you could set the nextSibling of the previous sibling of the usr tree to null.

But detach is a lot simpler.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mgk
PostPosted: Sat Sep 15, 2007 8:22 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Jeff is spot on here.

Under the covers ESQL calls the equivalent of detach when you assign NULL to an element.


Regards,


MGk
_________________
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
christian witschel
PostPosted: Sun Sep 16, 2007 4:33 am    Post subject: Reply with quote

Apprentice

Joined: 07 Dec 2005
Posts: 27

Thank you very much, doing

MbElemnt m = refOutput.getFirstElementByPath("/MQRFH2/usr");
m.detach();
m = null;

did the trick.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Java Equivalent of SET OutputRoot.MQRFH2.usr = null;
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.