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 » Why do we need to declare a constant as Shared Constant?

Post new topic  Reply to topic
 Why do we need to declare a constant as Shared Constant? « View previous topic :: View next topic » 
Author Message
philips79
PostPosted: Mon Jun 02, 2014 8:55 am    Post subject: Why do we need to declare a constant as Shared Constant? Reply with quote

Newbie

Joined: 02 Jun 2014
Posts: 2

In ESQL we have SHARED CONSTANTS, Why do we need them when they are constant and they don't change even if multiple threads access the same value.

DECLARE MYCONST SHARED CONSTANT CHAR 'My Constant';
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Jun 02, 2014 9:39 am    Post subject: Reply with quote

Grand High Poobah

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

You don't have to. However it makes sense when you know that the value will not change across multiple instances of the flow...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
philips79
PostPosted: Tue Jun 03, 2014 1:44 am    Post subject: Reply with quote

Newbie

Joined: 02 Jun 2014
Posts: 2

Can you tell me how can any other flow instance change a CONSTANT value?

Constant are meant to fixed values. so they are declared as constants.

How can A constant value change??? Sorry I am confused.......
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jun 04, 2014 5:51 pm    Post subject: Reply with quote

Grand High Poobah

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

philips79 wrote:
Can you tell me how can any other flow instance change a CONSTANT value?

Constant are meant to fixed values. so they are declared as constants.

How can A constant value change??? Sorry I am confused.......

It's not about changing the value. It's about accessing it.
Making it shared allows you to define it once and access it many times depending on the scope in your declaration...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Esa
PostPosted: Wed Jun 04, 2014 11:55 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

fjb_saper wrote:
It's about accessing it.
Making it shared allows you to define it once and access it many times depending on the scope in your declaration...


fjb_saper, please elaborate with an example.

You cannot access a constant from another broker schema even if it was SHARED.

You can access a schema level constant declared on the same schema regardless if it is SHARED or not. And you only can declare it once regardless if it's SHARED or not.

You cannot access a constant declared in some other module on the same schema regardless if it's SHARED or not.

You cannot declare a constant within a function or procedure.

So what is the difference between a SHARED CONSTANT and an ordinary CONSTANT? There must be something that I have overlooked?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jun 05, 2014 6:25 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

A SHARED constant will only be defined once.

A non-shared CONSTANT will be redefined in each ESQL node that uses the schema.
Back to top
View user's profile Send private message
Esa
PostPosted: Thu Jun 05, 2014 6:55 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

mqjeff wrote:
A SHARED constant will only be defined once.

A non-shared CONSTANT will be redefined in each ESQL node that uses the schema.


Thanks, mqjeff. That makes sense. So declaring a constant as shared may make the compiled flow footprint a little smaller in runtime if the constant is accessed by several nodes.
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 » Why do we need to declare a constant as Shared Constant?
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.