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 » ESQL : Issue while Accessing variable in Environment Tree

Post new topic  Reply to topic
 ESQL : Issue while Accessing variable in Environment Tree « View previous topic :: View next topic » 
Author Message
hellobond070
PostPosted: Mon Nov 23, 2009 4:26 am    Post subject: ESQL : Issue while Accessing variable in Environment Tree Reply with quote

Centurion

Joined: 18 Nov 2009
Posts: 118

Hi All,

I have an issue while accessing Environment variable.

Below is the illustration of the problem :

I pick values from Database and set the array "Datastruct" which has field "Sid109" and its corresponding value as "xxx@abc.com"

If I assign
SET TEMP= Environment.Datastruct.Sid109;
I get the correct value i.e. TEMP = xxx@abc.com

But when I assign
SET TEMPVAR=Sid109;
And then set
SET TEMP= Environment.Datastruct.TEMPVAR;

I get NULL value for TEMP and not xxx@abc.com.

I don't understand, why this substitution is not working for me ????
Any solution to this ...thanks in advance.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Nov 23, 2009 4:44 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Hi hellobond070,
Quote:
I don't understand, why this substitution is not working for me ????
This would be very simple to diagnose by reading a user trace. I strongly suggest that you generate a user trace now. You will probably solve your problem in 15 minutes, and as a bonus you will have learned a really important diagnostic technique.
Back to top
View user's profile Send private message
hellobond070
PostPosted: Mon Nov 23, 2009 4:53 am    Post subject: Reply with quote

Centurion

Joined: 18 Nov 2009
Posts: 118

Hello Kimbert,

I did try everything at my end..and finally gave up...and put this query to everyone.

I tried debugging using user trace....broker assigns a NULL VALUE.
Before assinging the log says ..."Failed to navigate path element...."

I in fact used a visual debugging tool in WBIMB 6.1 and saw everything goes fine, but only when I use the "TEMPVAR" variable I get NULL value assigned.

I feel it's literally going for Environment.Datastruct.TEMPVAR when it actually should be looking for Environment.Datastruct.TEMPVAR.Sid109


This looks to be a simple problem...yet m not able to resolve this issue
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Nov 23, 2009 4:59 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Fair enough. Sorry for suggesting something that you already tried. But you didn't *say* that you had tried it...

Best way forward would be to post the relevant part of the user trace.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Nov 23, 2009 5:03 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Don't double Post. It is considered rude

http://www.mqseries.net/phpBB2/viewtopic.php?t=51646

Take a look at my reply to your original post.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
hellobond070
PostPosted: Mon Nov 23, 2009 5:27 am    Post subject: Reply with quote

Centurion

Joined: 18 Nov 2009
Posts: 118

I m sorry for the inconvenience Davies99 for double Post...Appreciate your effort..Thanks.


Below is the log user trace :
Executing statement ''SET TEMP1 = TRIMBOTH(BOTH FROM CAST(TEMP AS CHARACTER));'' at ('XXXYYY_ERROR_Compute.Main', '30.3').
Evaluating expression ''TEMP'' at ('XXXYYY_ERROR_Compute.Main', '30.25'). This resolved to ''TEMP''. The result was '''Sid109'''.
Evaluating expression ''CAST(TEMP AS CHARACTER)'' at ('XXXYYY_ERROR_Compute.Main', '30.20'). This resolved to ''CAST('Sid109' AS CHARACTER)''. The result was '''Sid109'''.
Evaluating expression ''TRIMBOTH(BOTH FROM CAST(TEMP AS CHARACTER))'' at ('XXXYYY_ERROR_Compute.Main', '30.15'). This resolved to ''TRIMBOTH('Sid109', NULL)''. The result was '''Sid109'''.
Executing statement ''SET TOEmail = Environment.TEMPVAR.TEMP1;'' at ('XXXYYY_ERROR_Compute.Main', '31.3').
('XXXYYY_ERROR_Compute.Main', '31.17') : Failed to navigate to path element number '3' because it does not exist.
Evaluating expression ''Environment.TEMPVAR.TEMP1'' at ('XXXYYY_ERROR_Compute.Main', '31.17'). This resolved to ''Environment.TEMPVAR.TEMP1''. The result was ''NULL''.
Executing statement ''SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*:*.(XMLNSC.Attribute)Version = '1.0';'' at

The scenario I explained was to make everybody undersand the issue. Actually I m trying to read the input coming XML field data whose value is Sid109 as of now. But this value wud keep changing and the corresponding email id wud be picked frm the database table. As of now i m trying with this value.

I m assigning this value to TEMP1 as evident from the usertrace log and ''Environment.TEMPVAR.TEMP1'' should fetch me the required email id since TEMPVAR array has already been populated with database values.

I hope I am clear...Waiting for replies
Back to top
View user's profile Send private message
Herbert
PostPosted: Mon Nov 23, 2009 5:43 am    Post subject: Reply with quote

Centurion

Joined: 05 Dec 2006
Posts: 146
Location: Leersum, The Netherlands

hellobond070 wrote:
I m assigning this value to TEMP1 as evident from the usertrace log and ''Environment.TEMPVAR.TEMP1'' should fetch me the required email id since TEMPVAR array has already been populated with database values.

Is this perhaps inside an error handling you have connected to the Failure terminal? The Failure terminal starts with a clean Environment.
Back to top
View user's profile Send private message Visit poster's website
hellobond070
PostPosted: Mon Nov 23, 2009 5:45 am    Post subject: Reply with quote

Centurion

Joined: 18 Nov 2009
Posts: 118

Hello Herbert,

No, this isn't connected to the failure terminal.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Nov 23, 2009 5:49 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

I get what you are trying to do.

You are trying to create a dynamic field name reference to your daya tree.

you say the the name of the field which is currently Sid109 might change but you still want to get the data.

You can get the field name by using the .FieldName option.
Create a reference to Environment.DataStruct
Then you can navigate down the list of fields and select the right one using the .FieldName option.

This type of abstraction is not easy in ESQL and might not be worthwhile.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Herbert
PostPosted: Mon Nov 23, 2009 5:50 am    Post subject: Reply with quote

Centurion

Joined: 05 Dec 2006
Posts: 146
Location: Leersum, The Netherlands

hellobond070 wrote:
No, this isn't connected to the failure terminal.


In that case you did not set Environment.TEMPVAR.TEMP1 , show the code and trace where you did set this.
Back to top
View user's profile Send private message Visit poster's website
hellobond070
PostPosted: Mon Nov 23, 2009 5:51 am    Post subject: Reply with quote

Centurion

Joined: 18 Nov 2009
Posts: 118

I guess the problem is TEMPVAR not getting subtituted with Sid109. I even tried FIELDVALUE(Environment.Datastruct.TEMPVAR) function but in vain.

Quote:
Below is the illustration of the problem :

I pick values from Database and set the array "Datastruct" which has field "Sid109" and its corresponding value as "xxx@abc.com"

If I assign
SET TEMP= Environment.Datastruct.Sid109;
I get the correct value i.e. TEMP = xxx@abc.com

But when I assign
SET TEMPVAR=Sid109;
And then set
SET TEMP= Environment.Datastruct.TEMPVAR;

I get NULL value for TEMP and not xxx@abc.com.
Back to top
View user's profile Send private message
Herbert
PostPosted: Mon Nov 23, 2009 5:56 am    Post subject: Reply with quote

Centurion

Joined: 05 Dec 2006
Posts: 146
Location: Leersum, The Netherlands

smdavies99 wrote:
I get what you are trying to do.

You are trying to create a dynamic field name reference to your daya tree.

you say the the name of the field which is currently Sid109 might change but you still want to get the data.

You can get the field name by using the .FieldName option.
Create a reference to Environment.DataStruct
Then you can navigate down the list of fields and select the right one using the .FieldName option.

This type of abstraction is not easy in ESQL and might not be worthwhile.


ok, now I understand, I have done something in the past, not sure about the syntax, it's something like below:

SET TEMPVAR = 'Sid109';
SET TEMP = Environment.Datastruct.{TEMPVAR};

hgj
Back to top
View user's profile Send private message Visit poster's website
hellobond070
PostPosted: Mon Nov 23, 2009 5:56 am    Post subject: Reply with quote

Centurion

Joined: 18 Nov 2009
Posts: 118

Hello Herbert,

I did set the Environment variable. Environment gets set using a function which I call which fetchces several values including email value for Sid109 when called.

In fact my problem illustration clearly states the fact that setting of environment is working and the issue is with ESQL code.
Quote:
If I assign
SET TEMP= Environment.Datastruct.Sid109;
I get the correct value i.e. TEMP = xxx@abc.com


The problem is in the second scenario using a variable

Quote:
But when I assign
SET TEMPVAR=Sid109;
And then set
SET TEMP= Environment.Datastruct.TEMPVAR;

I get NULL value for TEMP and not xxx@abc.com.
Back to top
View user's profile Send private message
hellobond070
PostPosted: Mon Nov 23, 2009 6:04 am    Post subject: Reply with quote

Centurion

Joined: 18 Nov 2009
Posts: 118

Hello Herbert,

Hurrrrrrrrrrrrrrrrrrrrayyyyyyy...it's working now....Thankssssssssss a lot HERBERT!!


Thanks smdavies99 and Kimbert !!!!!!!!!!

SOLUTION !!!!!!!!!
Quote:


SET TEMPVAR = 'Sid109';
SET TEMP = Environment.Datastruct.{TEMPVAR};
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 » ESQL : Issue while Accessing variable in Environment 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.