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 Global Constants File

Post new topic  Reply to topic
 ESQL Global Constants File « View previous topic :: View next topic » 
Author Message
cwazpitt3
PostPosted: Fri Jan 20, 2012 9:23 am    Post subject: ESQL Global Constants File Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

What I am trying to achieve seems like it should work, but I cannot seem to get it to work.

I would like to have an ESQL file that lives in a common project (or even within the same project) that will just house CONSTANTs and then use those across the application. It seems I can achieve this if everything is in the same SCHEMA, however, that is really not what I want in this case. Here is what I tried:

FILE: Constants.esql
----------------------------------------------------------------
Code:
SCHEMA com.company.common;
DECLARE const1 CONSTANT CHARACTER 'somevalue';


FILE: FlowTest.esql
----------------------------------------------------------------
Code:
SCHEMA com.company.common.flows;
PATH com.company.common;

CREATE COMPUTE MODULE FlowTest_Compute
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
              DECLARE testVar CHARACTER const1;
              RETURN TRUE;
   END;
END MODULE;



Now with this setup, I get warnings in Toolkit and when I deploy, I get a "correlation name 'const1' is not valid" error. Now I have tried putting the constant esql in broker schema as some documentation eludes to it may work that way, but no luck there either. If I would move constants into the same SCHEMA as the FlowTest, it would work.

Is this just not possible in ESQL?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jan 20, 2012 9:53 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fak05105_.htm
Back to top
View user's profile Send private message
cwazpitt3
PostPosted: Fri Jan 20, 2012 11:54 am    Post subject: Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

I have seen this, but as I re-read it, I notice it mentions functions and procedures but not constants

Quote:
The PATH clause is used to resolve unqualified function and procedure names in the tools according to the following algorithm.


Is this what you meant for me to get out of that?
Back to top
View user's profile Send private message
adubya
PostPosted: Fri Jan 20, 2012 12:04 pm    Post subject: Reply with quote

Partisan

Joined: 25 Aug 2011
Posts: 377
Location: GU12, UK

Constants (and namespace declarations) can't be shared across schemas if my memory serves me correctly.

http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fak01100_.htm

Constants
Constants are locally reusable and can be used where they are defined in any ESQL or mapping file within the same broker schema.
Constants are not globally reusable; you cannot use a constant that is declared in another schema.


Last edited by adubya on Sat Jan 21, 2012 7:06 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
lancelotlinc
PostPosted: Fri Jan 20, 2012 12:25 pm    Post subject: Reply with quote

Jedi Knight

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

Another great use-case for solidDB !!


_________________
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
cwazpitt3
PostPosted: Fri Jan 20, 2012 1:01 pm    Post subject: Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

lancelotlinc wrote:
Another great use-case for solidDB !!


Might be overkill for this application, but certainty seems like a viable option for future projects.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Jan 20, 2012 1:15 pm    Post subject: Reply with quote

Grand High Poobah

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

adubya wrote:
Constants (and namespace declarations) can't be shared across schemas if my memory serves me correctly.

http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fak05105_.htm

Constants
Constants are locally reusable and can be used where they are defined in any ESQL or mapping file within the same broker schema.
Constants are not globally reusable; you cannot use a constant that is declared in another schema.


I don't think IMHO the constant word as meant in that part of the documentation referred to constant variables... more to the syntactical make up of the broker code isolation levels...

Those isolation levels will then dictate the scope.
Remember the scope can be modified by things like the PATH keyword...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mgk
PostPosted: Fri Jan 20, 2012 1:33 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
Constants (and namespace declarations) can't be shared across schemas


This is correct. However, there is a simple way to achieve this which is to add a "getter" Function which returns the constant as Functions can be shared across schemas.


Kind regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Jan 20, 2012 1:37 pm    Post subject: Reply with quote

Grand High Poobah

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

Thanks for qualifying this mgk.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
cwazpitt3
PostPosted: Mon Jan 23, 2012 11:44 am    Post subject: Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

mgk wrote:
This is correct. However, there is a simple way to achieve this which is to add a "getter" Function which returns the constant as Functions can be shared across schemas.


This is what I had done in place of constants, just wanted to get clarification that I wasn't missing something. Thanks for your help!

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 Global Constants File
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.