Author |
Message
|
Amitha |
Posted: Fri Aug 20, 2010 11:55 am Post subject: Create Statement with Alias |
|
|
 Voyager
Joined: 20 Nov 2009 Posts: 80 Location: Newyork
|
Hi,
WMB 6.10.7, Windows XP.
I am using following ESQL expression to create an element in output tree with an alias reference:
Code: |
CREATE LASTCHILD OF OutputRoot.XMLNSC.ParentMSG AS outputMsgRef NAME 'ChildMsg';
|
This is giving warning on toolkit Identifier "outputMsgRef" cannot be resolved.
During deploy time it throws up
Code: |
BIP2432E: The correlation name 'outputMsgRef' is not valid. Those in scope are: Environment, InputLocalEnvironment, OutputLocalEnvironment, InputRoot, InputBody, InputProperties, OutputRoot, InputExceptionList, OutputExceptionList, InputDestinationList, OutputDestinationList, envVarRef |
I wonder why this is not working, is this a bug or I am doing something wrong.
The following code works, I wanted to try alias reference with create statement.
Code: |
CREATE LASTCHILD OF OutputRoot.XMLNSC.ParentMSG NAME 'ChildMsg';
DECLARE outputMsgRef REFERENCE TO OutputRoot.XMLNSC.ParentMSG.ChildMsg; |
|
|
Back to top |
|
 |
Vitor |
Posted: Fri Aug 20, 2010 12:21 pm Post subject: Re: Create Statement with Alias |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Have you tried:
Code: |
DECLARE outputMsgRef REFERENCE TO OutputRoot;
...
CREATE LASTCHILD OF OutputRoot.XMLNSC.ParentMSG AS outputMsgRef NAME 'ChildMsg';
|
_________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Amitha |
Posted: Fri Aug 20, 2010 1:05 pm Post subject: |
|
|
 Voyager
Joined: 20 Nov 2009 Posts: 80 Location: Newyork
|
Quote: |
DECLARE outputMsgRef REFERENCE TO OutputRoot;
...
CREATE LASTCHILD OF OutputRoot.XMLNSC.ParentMSG AS outputMsgRef NAME 'ChildMsg'; |
Thanks this works. But I thought CREATE Statement will create reference variable just like FOR statement does. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Aug 20, 2010 4:33 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Amitha wrote: |
But I thought CREATE Statement will create reference variable just like FOR statement does. |
Nope, just does a MOVE _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Aug 20, 2010 6:21 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vitor wrote: |
Amitha wrote: |
But I thought CREATE Statement will create reference variable just like FOR statement does. |
Nope, just does a MOVE |
...
Really?
Interesting. I was not aware of that subtlety. |
|
Back to top |
|
 |
Vitor |
Posted: Sat Aug 21, 2010 4:42 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
Interesting. I was not aware of that subtlety. |
AFAIK it's not stated in the documentation that it only does a move; nor does it state that CREATE doesn't need the reference pre-defined.
(Happy to be corrected there)
I just hit this problem a few years back and that's how I fixed it. _________________ Honesty is the best policy.
Insanity is the best defence.
Last edited by Vitor on Sun Aug 22, 2010 1:12 pm; edited 1 time in total |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Aug 22, 2010 12:21 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Even though it's not stated in the doc, AFAIK, in order to assign a reference in the CREATE statememt, that reference has to exist (be declared) first...
What I never tried was to combine the 2 statements...like
Code: |
CREATE LASTCHILD OF OutputRoot.XMLNSC.ParentMSG AS DECLARE outputMsgRef NAME 'ChildMsg'; |
If anybody tried this let us know ... my guess is you'll get a syntax error.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mgk |
Posted: Sun Aug 22, 2010 3:49 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Quote: |
CREATE LASTCHILD OF OutputRoot.XMLNSC.ParentMSG AS DECLARE outputMsgRef NAME 'ChildMsg'; |
This cannot work as DECLARE is a statement, not an expression...
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 |
|
 |
|