Author |
Message
|
zuresh2zuresh |
Posted: Wed Mar 18, 2009 11:51 pm Post subject: To add special charcters and keywords as tag value in ESQL |
|
|
Newbie
Joined: 18 Mar 2009 Posts: 2
|
My desired output for a tag in the outbound XML.
<TagA>'Reporting Contact First Name, Contact Surname or Contact Phone Number'</TagA>
By trial and error method and based on logical assumptions, I achieved the output with the below mentioned code. Can any one of you give a technical explanation on how it works?
Declare a CHARACTER '''Reporting Contact First Name, Contact Surname or Contact Phone Number''';
Then followed by usual SET statement.
Cheers,
Suresh S |
|
Back to top |
|
 |
MQEnthu |
Posted: Thu Mar 19, 2009 12:34 am Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
zuresh2zuresh wrote: |
My desired output for a tag in the outbound XML.
<TagA>'Reporting Contact First Name, Contact Surname or Contact Phone Number'</TagA>
By trial and error method and based on logical assumptions, I achieved the output with the below mentioned code. Can any one of you give a technical explanation on how it works?
Declare a CHARACTER '''Reporting Contact First Name, Contact Surname or Contact Phone Number''';
Then followed by usual SET statement. |
What strange thing you have noticed here ... you have to use an additional ' if you want a single quote in your character literal..
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ak17830_.htm  _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
MQEnthu |
Posted: Thu Mar 19, 2009 1:11 am Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
And please get this moved to correct section... _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
zuresh2zuresh |
Posted: Thu Mar 19, 2009 2:09 am Post subject: |
|
|
Newbie
Joined: 18 Mar 2009 Posts: 2
|
But I've used three codes (').... I am not able to get the output with two codes
Cheers,
Suresh S |
|
Back to top |
|
 |
Vitor |
Posted: Thu Mar 19, 2009 2:20 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Moved to correct section _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mgk |
Posted: Thu Mar 19, 2009 2:55 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Three ' is correct.
A CHARACTER literal is delimited by ' so the outer pair are for the literal string.
Then to use a literal ' inside a string literal it needs to be escaped by another ', so you end up with three ' in your case. If the literal ' was somewhere inside the string (not at the ends) then it would look easier to read for example :
Code: |
DECLARE x CHAR 'can''t you feel the music?'; |
This is documented in topic: ak17830
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 |
|
 |
|