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 Shared Variables

Post new topic  Reply to topic
 Accessing Shared Variables « View previous topic :: View next topic » 
Author Message
polydegmon
PostPosted: Fri Oct 07, 2011 5:10 am    Post subject: Accessing Shared Variables Reply with quote

Novice

Joined: 07 Oct 2011
Posts: 11

I'm using a shared variable to store a set of rules that need to be accessed in other flows in the EXE group. However I'm getting an error with it.

The shared row is defined in subflow A, outside the module scope.

Code:
DECLARE CachedRulesTable SHARED ROW;


It's being set in subflow A inside a ESQL compute node module, it's not being set in the Main function however it's been set in a procedure that's called by the main function.

Code:
ROUTING : BEGIN ATOMIC
   SET CachedRulesTable.QueryParameters.SearchParams.notsearchable = 'TEST';
END;


I need to access it in subflow B, the code I'm using is below

Code:
DECLARE Result ROW;

SET Result.Info[] = (SELECT R.notsearchable
FROM CachedRulesTable.QueryParameters.SearchParams[] AS R
WHERE R.name = SearchParmID);


I only get the error when I try to deploy it, the error I get is
Quote:
The correlation name 'CachedRulesTable' is not valid.


Any help on this would be greatly appreciated.

Thanks
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Oct 07, 2011 5:11 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Shared variables are scoped to either the module or the schema they are defined in.

Shared variables are only exposed to other instances of the SAME message flow, you can NOT use them to share data BETWEEN message flows.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Fri Oct 07, 2011 6:03 am    Post subject: Reply with quote

Jedi Knight

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

If you attend the IBM provided training class WM663, the instructor will show you how to share data between flows and between nodes of a flow.
_________________
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
polydegmon
PostPosted: Fri Oct 07, 2011 6:32 am    Post subject: Reply with quote

Novice

Joined: 07 Oct 2011
Posts: 11

Hi lancelotlinc i attended an IBM course a few months ago in london where we did learn about the use of shared variables and the atomic keyword to protect them, however there was no code example of how to do it. Just a brief talk on how it could be done.

If you could let me know or point me in the right direction I'd appreciate it.

Thanks
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Oct 07, 2011 6:41 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

polydegmon wrote:
Hi lancelotlinc i attended an IBM course a few months ago in london where we did learn about the use of shared variables and the atomic keyword to protect them, however there was no code example of how to do it. Just a brief talk on how it could be done.

If you could let me know or point me in the right direction I'd appreciate it.

Thanks


The code you have is fine for sharing data across instances of a single message flow.

SHARED variables DO NOT let you share data between message flows.

There are many other ways, with varying different complexities and performance costs, that DO let you share data between message flows.

Do some searching, do some thinking, you'll find a few. Do some testing to make sure you meet your own requirements.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Oct 07, 2011 6:41 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.

polydegmon wrote:


If you could let me know or point me in the right direction I'd appreciate it.

Thanks


I figured it out about 5 years ago. It isn't that hard. Just have all the instances call a procedure which has the ATOMIC block inside it.

Go on, experiment. You might be surprised at what you can find out for yourself....
_________________
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
mqjeff
PostPosted: Fri Oct 07, 2011 6:43 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

smdavies99 wrote:
polydegmon wrote:


If you could let me know or point me in the right direction I'd appreciate it.

Thanks


I figured it out about 5 years ago.


SHARED variables didn't exist five years ago.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Oct 07, 2011 6:53 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.

mqjeff wrote:

SHARED variables didn't exist five years ago.


I used them with V6.0 which If I remember correctly came out in 2006. But as the saying goes, time files and corrupts memory. So it could have been 2007.
_________________
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
mqjeff
PostPosted: Fri Oct 07, 2011 6:56 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

smdavies99 wrote:
mqjeff wrote:

SHARED variables didn't exist five years ago.


I used them with V6.0 which If I remember correctly came out in 2006. But as the saying goes, time files and corrupts memory. So it could have been 2007.


Oh goodness.

Where's that banana?
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Oct 07, 2011 7:16 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mqjeff wrote:
Oh goodness.

Where's that banana?


Sooner or later advancing years (and increasing coffee consumption) catch up with us all.

I myself used to have a perfect memory, but now I can't remember what happened to it.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 Shared Variables
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.