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 » Accessing Variables within {} in ESQL

Post new topic  Reply to topic
 Accessing Variables within {} in ESQL « View previous topic :: View next topic » 
Author Message
sarathsps
PostPosted: Fri May 23, 2014 7:22 am    Post subject: Accessing Variables within {} in ESQL Reply with quote

Novice

Joined: 04 May 2006
Posts: 19

I have a situation like this

declare TEMP CHAR '{ns3}:A.{ns3}:B';
declare a2 reference to InputRoot.XMLNSC.{ns2}:BCM.{ns3}:ChangeSegment.{TEMP};

when i have a variable value which contains {} it is not resolving the field.

I tried with
declare TEMP CHAR '"{ns3}:A.{ns3}:B"'; also and it is not working.

Is there any way we can resolve the field which inside the {}.

Thanks for your help.
Back to top
View user's profile Send private message
McueMart
PostPosted: Fri May 23, 2014 7:48 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

Does

declare TEMP CHAR 'ns3:A.ns3:B';
declare a2 reference to InputRoot.XMLNSC.{ns2}:BCM.{ns3}:ChangeSegment.{TEMP};

work? Just a guess...
Back to top
View user's profile Send private message
sarathsps
PostPosted: Fri May 23, 2014 8:00 am    Post subject: Reply with quote

Novice

Joined: 04 May 2006
Posts: 19

declare TEMP CHAR 'ns3:A.ns3:B';
declare a2 reference to InputRoot.XMLNSC.{ns2}:BCM.{ns3}:ChangeSegment.{TEMP};

Thanks for your response.

I tried the above and it is not working.
Back to top
View user's profile Send private message
McueMart
PostPosted: Fri May 23, 2014 8:12 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

What are ns2 and ns3 defined as? Are they CHARACTER variables which will resolve to a NAMESPACE variable you have previously defined?

Paste in more of your code please
Back to top
View user's profile Send private message
sarathsps
PostPosted: Fri May 23, 2014 8:19 am    Post subject: Reply with quote

Novice

Joined: 04 May 2006
Posts: 19

Thanks for your response... ns2 and ns3 are defined as namespaces.. Please see the below code.

DECLARE ns2 NAMESPACE 'http://abc.com/XXXX';

DECLARE ns3 NAMESPACE 'http://abc.com/XXXX/YYYY';

CREATE COMPUTE MODULE Test_Compute BEGIN

declare TEMP CHAR '{ns3}:A.{ns3}:B';
declare a2 reference to InputRoot.XMLNSC.{ns2}:BCM.{ns3}:ChangeSegment.{TEMP};

END;
Back to top
View user's profile Send private message
McueMart
PostPosted: Fri May 23, 2014 10:27 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

Ok, when using a NAMESPACE, you dont need to surround it in { }.

So lets have another go:

declare TEMP CHAR 'ns3:A.ns3:B';
declare a2 reference to InputRoot.XMLNSC.ns2:BCM.ns3:ChangeSegment.{TEMP};


Although - now I remember back - I vaguely recall that using path evaluation using the { } syntax, has a limitation whereby it can only evaluate to 1 folder, not the multiple levels you have (e.g. A.B).

So can you also try this:

declare TEMP CHAR 'ns3:A';
declare TEMP2 CHAR 'ns3:B';
declare a2 reference to InputRoot.XMLNSC.ns2:BCM.ns3:ChangeSegment.{TEMP}.{TEMP2};
Back to top
View user's profile Send private message
sarathsps
PostPosted: Fri May 23, 2014 12:23 pm    Post subject: Reply with quote

Novice

Joined: 04 May 2006
Posts: 19

McueMart wrote:
So can you also try this:

declare TEMP CHAR 'ns3:A';
declare TEMP2 CHAR 'ns3:B';
declare a2 reference to InputRoot.XMLNSC.ns2:BCM.ns3:ChangeSegment.{TEMP}.{TEMP2};


I tried above and not working
Back to top
View user's profile Send private message
McueMart
PostPosted: Fri May 23, 2014 1:29 pm    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

Ok the next I would try is something like:

declare TEMPNS CHAR 'ns3';
declare TEMP1 CHAR 'A';
declare TEMP2 CHAR 'B';
declare a2 reference to InputRoot.XMLNSC.ns2:BCM.ns3:ChangeSegment.{TEMPNS}:{TEMP1}.{TEMPNS}:{TEMP2};

As im not sure if the path substitution can replace the Namespace and field name in one go. If this doesn't work - im all out of ideas! Someone who knows the answer will be along shortly im sure
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri May 23, 2014 10:29 pm    Post subject: Reply with quote

Grand High Poobah

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

McueMart is right. The other possibility you have would be to use evaluate... but that would be a lot slower...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Mon May 26, 2014 1:37 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

My first programming mentor told me something very useful.
"If the problem seems too hard then try solving a different problem"

In this case, the problem is to end up with a REFERENCE variable 'a2' that points to *.ns3:A.ns3:B where * is an unknown ESQL field reference. You are trying very hard ( impressively hard ) to solve it using ESQL's path reference syntax + string manipulation. But it would be very easy to write an ESQL procedure that takes an ESQL REFERENCE variable 'a' and moves it to 'a2'. Is there some reason why that's not an acceptable solution?
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
sarathsps
PostPosted: Tue May 27, 2014 9:33 am    Post subject: Reply with quote

Novice

Joined: 04 May 2006
Posts: 19

fjb_saper wrote:
McueMart is right. The other possibility you have would be to use evaluate... but that would be a lot slower...

Have fun


I tried using the EVAL function in MB7 like below and it is not resolving the reference path..

declare TEMP CHAR 'ns3:A.ns3:B';
declare a2 reference to InputRoot.XMLNSC.ns2:BCM.ns3:ChangeSegment;

set a2=a2.EVAL(TEMP);
Back to top
View user's profile Send private message
sarathsps
PostPosted: Tue May 27, 2014 9:35 am    Post subject: Reply with quote

Novice

Joined: 04 May 2006
Posts: 19

kimbert wrote:
My first programming mentor told me something very useful.
"If the problem seems too hard then try solving a different problem"

In this case, the problem is to end up with a REFERENCE variable 'a2' that points to *.ns3:A.ns3:B where * is an unknown ESQL field reference. You are trying very hard ( impressively hard ) to solve it using ESQL's path reference syntax + string manipulation. But it would be very easy to write an ESQL procedure that takes an ESQL REFERENCE variable 'a' and moves it to 'a2'. Is there some reason why that's not an acceptable solution?



Hi Kimbert,

Thanks for your reply. I am not able to use the MOVE the another portion of the reference variable is still a char. The below one is not working.


DECLARE A3 REFERENCE TO InputRoot.XMLNSC.ns2:BCM.ns3:ChangeSegment;


set TEMP = 'ns2:PROVIDER.ns2:PROVIDER_SERVICE_LOCATION';

move A3 to A3.{TEMP};
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue May 27, 2014 9:44 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You can't use {} for more than one level i.e. A.B.C, you have to use A.{B}.{C}, not A.{B.C}.

It doesn't work.

You shouldn't be using {}.

You should be using MOVE FIRST CHILD
Back to top
View user's profile Send private message
Esa
PostPosted: Tue May 27, 2014 11:04 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

sarathsps wrote:
I am not able to use the MOVE the another portion of the reference variable is still a char


Read this

Code:

DECLARE A3 REFERENCE TO InputRoot.XMLNSC.ns2:BCM.ns3:ChangeSegment;
DECLARE MyProvider CHAR 'PROVIDER'
MOVE A3 FIRSTCHILD NAMESPACE ns2 NAME MyProvider;
--MOVE again
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 » Accessing Variables within {} 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.