Author |
Message
|
KIT_INC |
Posted: Fri Jan 28, 2011 8:35 am Post subject: Set domain dynamically in the create statement |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
I like to assign the domain name to the create statement dynamically. So I use ESQL
DECLARE DN CHAR ;
set DN=FIELDNAME(InputRoot.*[<]);
Create FIRSTCHILD of Environment DOMAIN '{DN}' Name 'XXMYDATA';
But {DN} did not get substitute with MRM or XMLNSC. I think this is because of the single quot around it.
I tried
Create FIRSTCHILD of Environment DOMAIN {DN} Name 'XXMYDATA';
I got syntax error because create expect ' ' around domain specified.
I tried
Create FIRSTCHILD of Environment DOMAIN '{FIELDNAME(InputRoot.*[<])}' Name 'XXMYDATA';
with no luck. It will deploy. But error out with trace output showing
The DOMAIN name ''{FIELDNAME(InputRoot.*[<])}'' is an invalid Root Element Name.
Any idea on how to do this ? |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jan 28, 2011 8:42 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Code: |
DOMAIN '''||{DN}||''' |
 |
|
Back to top |
|
 |
KIT_INC |
Posted: Fri Jan 28, 2011 8:59 am Post subject: |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
Thanks mqjeff, but it did not work. Error in trace still says
''SET DN = FIELDNAME(InputRoot.*:*[<]);'' at ...... :
The result was '''MRM'''.
:
:
The DOMAIN name '''||{DN}||''' passed to the DOMAIN clause of the CREATE statement is not a valid Root Element Name.
The DOMAIN name '''||{DN}||''' is an invalid Root Element Name. |
|
Back to top |
|
 |
mgk |
Posted: Fri Jan 28, 2011 10:46 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Did you try:
Code: |
Create FIRSTCHILD of Environment DOMAIN DN Name 'XXMYDATA'; |
? _________________ 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 |
|
 |
Featherstone |
Posted: Mon Jan 31, 2011 2:31 am Post subject: |
|
|
Novice
Joined: 18 Oct 2010 Posts: 11
|
As mgk has stated the following should work
Code: |
DECLARE DN CHAR ;
set DN=FIELDNAME(InputRoot.*[<]);
Create LASTCHILD of OutputRoot DOMAIN DN Name DN;
CREATE LASTCHILD OF OutputRoot.*[<] NAME 'TestSample' VALUE 'foo'; |
Help has:
Quote: |
DOMAIN clause:
If present, the DOMAIN clause associates the new field with a new parser of the specified type. This clause expects a root field name (for example, XMLNS or MQRFH2). |
Specifying the NAME as well as the DOMAIN class as using the variable DN will give the results you want. |
|
Back to top |
|
 |
KIT_INC |
Posted: Mon Jan 31, 2011 8:26 am Post subject: |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
Thanks a lot for all the help
Create FIRSTCHILD of Environment DOMAIN DN Name 'XXMYDATA'; works |
|
Back to top |
|
 |
|