Author |
Message
|
skol |
Posted: Fri Jul 07, 2006 8:56 am Post subject: User Defined Property and EXTERNAL |
|
|
Apprentice
Joined: 05 Apr 2006 Posts: 38
|
I'm trying to access the value of a user defined property (UDP) on a subflow from the subflow's ESQL. The help indicates that the EXTERNAL keyword is used for this on a declare, so I have this declare statement in ESQL:
DECLARE FlowAndEnv EXTERNAL CHARACTER;
Where "FlowAndEnv" is the mandatory UDP. This looks fine in the workspace, but if I build a BAR using this flow and ESQL, set thae value of the UDP with the BAR editor, and then try to deploy that BAR, I get this error back from the configuration manager and the deploy fails:
BIP2402E: (.POWER_PLANT_DATABASE_ERROR_SubFlw_UPDATE_ERROR_TABLE.Main, 14.21) : Syntax error : 'keyword External'.
The token caused a syntax error.
Correct the syntax of your expression and redeploy the message flow.
Am I doing something stupid wrong with this? It is the first time I've attempted to do a UDP in V6, so I could easily be missing something, but I can't see what. Has anyone had success accessing the value of a UDP in ESQL?
Thanks in advance... _________________ Steve |
|
Back to top |
|
 |
wschutz |
Posted: Fri Jul 07, 2006 10:49 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
I have to ask, this is a V6 configmgr and broker, right? _________________ -wayne |
|
Back to top |
|
 |
venusboy |
Posted: Fri Jul 07, 2006 12:19 pm Post subject: |
|
|
Acolyte
Joined: 11 Jun 2002 Posts: 51
|
You will also have to add the UDP to the user-properties tab within your sub-flow. |
|
Back to top |
|
 |
skol |
Posted: Fri Jul 07, 2006 12:24 pm Post subject: |
|
|
Apprentice
Joined: 05 Apr 2006 Posts: 38
|
For the above two posts, yes it is V6.0.0.1 of the toolkit, and the subflow has the UDP already. I can edit the UDP values in the BAR editor, and I can see the values in the broker.xml file in the BAR, so I know the properties are defined. And I've quintuple-checked the spelling of the property name to be sure it matches the DECLARE.
Let me know if it's useful to post more detail on the patch level of MQ V6 as well as the broker and the toolkit - all have updates applied to the vanilla V6 installs.
Anything else I can try? Thanks to both of you for posting replies, I appreciate the help! _________________ Steve |
|
Back to top |
|
 |
wschutz |
Posted: Fri Jul 07, 2006 4:01 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
wschutz wrote: |
I have to ask, this is a V6 configmgr and broker, right? |
The question was about the level of the configmgr, not the toolkit. _________________ -wayne |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Jul 07, 2006 7:51 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi skol,
The DECLARE statement should not be within a Function....Put it right under the Module
Example:
Code: |
CREATE COMPUTE MODULE Dummy_Compute
DECLARE FlowAndEnv EXTERNAL CHARACTER;
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN |
Regards. |
|
Back to top |
|
 |
skol |
Posted: Mon Jul 10, 2006 4:16 am Post subject: |
|
|
Apprentice
Joined: 05 Apr 2006 Posts: 38
|
Thanks! I bet that'll do the trick... _________________ Steve |
|
Back to top |
|
 |
kspranava |
Posted: Mon Jul 24, 2006 9:20 am Post subject: |
|
|
 Centurion
Joined: 27 Apr 2003 Posts: 124
|
Hi,
I face some problems when using a UDP in subflows.
Sub flow(1):
input --> compute(2) --> output
(2) I have declared a UDP called 'testUDP'
Mainflow(3):
mqinput --> subflow(1) --> compute(4) --> mqoutput
(4) has only two lines
Copy messageheaders() and
SET OutputRoot.XML.UDP.testUDP = testUDP;
I have added a property 'testUDP' in User defined Properties section of Subflow(1) and promoted the same in the mainflow(3). I was able to see them in the bar file too.
But then deployment fails stating,
BIP2432E: (.Test_Compute.Main, 5.36) : The correlation name 'testUDP'
is not valid.
Where am I going wrong?
Thanks,
kspranava. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jul 24, 2006 9:55 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You need to declare the UDP in the Compute(4) ESQL code. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
skol |
Posted: Mon Jul 24, 2006 10:35 am Post subject: |
|
|
Apprentice
Joined: 05 Apr 2006 Posts: 38
|
And, as the post from 7/7 shows, make sure your DECLARE is at module scope. I got burned by that - I had mine at function scope, and it compiles fine in the toolkit, but BAR deployment fails with an error. Once I moved my declares to module scope, it worked fine. I use both flows and subflows and it all works. _________________ Steve |
|
Back to top |
|
 |
kspranava |
Posted: Wed Jul 26, 2006 12:54 am Post subject: |
|
|
 Centurion
Joined: 27 Apr 2003 Posts: 124
|
Hi Jefflowrey,
Quote: |
You need to declare the UDP in the Compute(4) ESQL code |
I have declared in compute(2), do I have to declare AGAIN in compute(4)?
skol wrote:
Quote: |
make sure your DECLARE is at module scope |
Yes, I have declared at the module scope.
Thanks,
kspranava. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jul 26, 2006 2:40 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
kspranava wrote: |
Hi Jefflowrey,
Quote: |
You need to declare the UDP in the Compute(4) ESQL code |
I have declared in compute(2), do I have to declare AGAIN in compute(4)? |
Yes. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
elvis_gn |
Posted: Wed Jul 26, 2006 3:08 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi,
jefflowrey wrote: |
kspranava wrote: |
Hi Jefflowrey,
Quote: |
You need to declare the UDP in the Compute(4) ESQL code |
I have declared in compute(2), do I have to declare AGAIN in compute(4)? |
Yes. |
Huh...wouldn't that mean then, that they are two different UDPs...
Shouldn't the UDP be declared at Compute(4), since it is at a higher level, and then become automatically accessible in Compute(2)...
Regards. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jul 26, 2006 3:46 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Elvis_gn - I admit, in this case I'm not 100% certain. I should have said "I guess so", rather than "yes".
But I know you need to declare SHARED variables anywhere you want to use them.
And, looking at the info center a bit more - it seems that the UDP is actually created by the Message Flow Editor and NOT by the ESQL Declare statement. As well as being defined using the Message flow editor, a UDP must also be defined using either a DECLARE statement with the EXTERNAL keyword in any ESQL program that uses it, or the getUserDefinedAttribute method in any JavaCompute node that uses it.
My emphasis. So I think that the Declare..External just links in the UDP storage space.
Also, as skol says, you should declare this either at the module level - or in this case it should probably be in the SCHEMA level, and both Compute(2) and Compute(4)'s ESQL should use the same schema.
If it's declared at module scope in Compute(2), it won't be visible in a different module scope in Compute(4) unless it's also defined in that module. But even then, it should be the same variable, because it points to the same UDP. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kspranava |
Posted: Wed Jul 26, 2006 5:44 am Post subject: |
|
|
 Centurion
Joined: 27 Apr 2003 Posts: 124
|
Hi All,
Thanks for the replies. I got it working. Here is how it goes.
As elvis_gn said UDP has to be declared in compute(4); ie at the main flow. So that it is accessible to all lower level flows. By this way any node in subflows will have access to the UDP with the default value. If the value has to be set at subflows, just add a UDP of same name under property group of the subflow.
Thanks,
kspranava. |
|
Back to top |
|
 |
|