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 » Difference between the Two statements

Post new topic  Reply to topic
 Difference between the Two statements « View previous topic :: View next topic » 
Author Message
VIVEK MOHAN
PostPosted: Sun Feb 24, 2013 11:06 pm    Post subject: Difference between the Two statements Reply with quote

Newbie

Joined: 21 Feb 2013
Posts: 5

Hello All,

I am using both the below statements to serve my purpose but i don't know which statement is effective and why??

DECLARE ref1 REFERENCE TO OutputRoot.XMLNSC.Order.Summary.CustomerDetails;


set ref1=OutputRoot.XMLNSC.Order.Summary.CustomerDetails;
Back to top
View user's profile Send private message
Veera B
PostPosted: Sun Feb 24, 2013 11:44 pm    Post subject: Reply with quote

Voyager

Joined: 16 Jan 2013
Posts: 76

first be clear on what you want to do ..

The first statement is to create a reference variable, like a pointer ..

the second statement is to set a value to ... a variable, xml element etc ...

But what you are doing here is wrong ... you are trying to set value to a reference ...

the purpose of taking a refernce is to make the code more efficient and easy to write ..

for example from your code , i would do this :-

Declare ref1 Reference to OutputRoot.XMLNSC.Order.Summary;

Set Element1 = ref1 .CustomerDetails;
Set Element2 = ref1 .CustomerSomething ....

Please go trough the samples provided carefully and also go trough the info center for solving doubts...
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Feb 25, 2013 3:41 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

@veeraB You are treating in your example the reference as if it were a ref to InputRoot. The OP clearly stated that it was a ref to OutputRoot...

The second statement given by the OP makes no sense. It is already covered by the first statement declaring the ref.

However you should always check LASTMOVE after assigning or moving a reference...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
longng
PostPosted: Mon Feb 25, 2013 10:54 am    Post subject: Reply with quote

Apprentice

Joined: 22 Feb 2013
Posts: 42

fjb_saper wrote:
@veeraB You are treating in your example the reference as if it were a ref to InputRoot. The OP clearly stated that it was a ref to OutputRoot...

The second statement given by the OP makes no sense. It is already covered by the first statement declaring the ref.

However you should always check LASTMOVE after assigning or moving a reference...

Have fun


I agree that the second statement makes no sense, i.e. Assigning a value in the variable to itself! That is because ref1 points to OutputRoot.XMLNSC.Order.Summary.CustomerDetails.

For checking the LASTMOVE, it would be valid to use only to operations related to reference variables, e.g.

Code:

DECLARE ref1 REFERENCE TO OutputRoot.XMLNSC.Order.Summary;
 MOVE ref1 to OutputRoot.XMLNSC.Order.Summary.CustomerDetails;
 IF (LASTMOVE (ref1)
   -- Successful move!
   SET ref1 = 'Jane Doe';
   -- Equivalent to SET OutputRoot.XMLNSC.Order.Summary.CustomerDetails = 'Jane Doe';
 ELSE
   -- Something wrong, the ref1 is not valid for use.
 END IF;


For clarity, the SET statement does not change the reference variable itself, it only affects the contents of the variable pointed to by the reference.
Back to top
View user's profile Send private message
Veera B
PostPosted: Tue Feb 26, 2013 6:54 am    Post subject: Reply with quote

Voyager

Joined: 16 Jan 2013
Posts: 76

fjb_saper wrote:
@veeraB You are treating in your example the reference as if it were a ref to InputRoot. The OP clearly stated that it was a ref to OutputRoot...


Have fun



Oops .. posted in a hurry .. sorry .. solution was in my brain but didn't come out the way i wanted ...
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 » Difference between the Two statements
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.