Author |
Message
|
klabran |
Posted: Wed Jan 19, 2005 12:56 pm Post subject: newline character in esql... |
|
|
 Master
Joined: 19 Feb 2004 Posts: 259 Location: Flagstaff AZ
|
How do I add the newline character to a character variable in esql....
I am trying to format my output for an email.
Kevin
Last edited by klabran on Thu Jan 20, 2005 7:30 am; edited 1 time in total |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jan 19, 2005 1:17 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You can convert a BLOB hex character return value to a character, and concatenate that.
Or you can concatenate a carriage return inside single quotes, literally
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
klabran |
Posted: Wed Jan 19, 2005 1:22 pm Post subject: |
|
|
 Master
Joined: 19 Feb 2004 Posts: 259 Location: Flagstaff AZ
|
Thanks!  |
|
Back to top |
|
 |
kirani |
Posted: Wed Jan 19, 2005 11:42 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
jefflowrey wrote: |
Or you can concatenate a carriage return inside single quotes, literally |
This is an undocumented feature, so I'd not use it I'd go with first option. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 20, 2005 5:02 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Is there any documentation that the ESQL parser might strip line endings from code?
Is there any doucmentation that the ESQL parser might in any way mangle string literals?
That is to say, it may be an undocumented feature, but there's no documentation to suggest it won't work either...
There is a bit of a problem with my second option, in that the return key will be in the character set of the Toolkit, which may not be the character set of the message being manipulated. This particularly could be a problem with email in the headers - although klabran is only talking about the body text.
So the first option is a lot more "safe", because it requires you to know what you want, rather than allowing the system to decide for you. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
alexey |
Posted: Thu Jan 20, 2005 5:47 am Post subject: |
|
|
 Acolyte
Joined: 18 Dec 2003 Posts: 62 Location: Israel
|
Quote: |
You can convert a BLOB hex character return value to a character, and concatenate that.
|
Simple and works fine:
Code: |
DECLARE CR CHAR CAST(CAST('X''0A''' AS BLOB) AS CHAR CCSID ...);
SET your_string = your_string||CR;
|
Alexey. |
|
Back to top |
|
 |
klabran |
Posted: Thu Jan 20, 2005 7:30 am Post subject: |
|
|
 Master
Joined: 19 Feb 2004 Posts: 259 Location: Flagstaff AZ
|
Thanks everyone for your input....
I did try and it works fine...
Quote: |
Or you can concatenate a carriage return inside single quotes, literally |
However, it looks like the second option is better so I will adjust accordingly.
Kevin |
|
Back to top |
|
 |
kirani |
Posted: Fri Jan 21, 2005 12:17 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
jefflowrey,
I never said that it will not work.
It's not documented anywhere, that's why I am afraid that IBM might remove this "feature" anytime. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jan 21, 2005 5:46 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
kirani wrote: |
I never said that it will not work. |
I know!
kirani wrote: |
It's not documented anywhere, that's why I am afraid that IBM might remove this "feature" anytime. |
It's true. But it's not documented that it WON'T work, either...
And I think that removing this feature would involve mangling string literals. And that would break LOTS of things besides this.
So personally I feel the risks are slight that it will be changed.
But using a converted BLOB literal is a little "cleaner" visually. I might tend even to assign it to a "constant" variable called "return" or somesuch. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
maxis |
Posted: Tue Feb 01, 2005 5:33 am Post subject: |
|
|
Centurion
Joined: 25 Jun 2002 Posts: 144
|
am having pretty much the similar requirement, where NEW-LINE is required. Am using CWF, have defined a element - newLine with 2 char length. Am using this newLine element where ever there is a need for NEW-LINE (or carriage return however one would like to call ).
I tried both the options its not working .. any suggestion/tip would be appreciated ...
wmsi version : 2.1
CSD : 6
thanks
M |
|
Back to top |
|
 |
kirani |
Posted: Tue Feb 01, 2005 11:43 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
What is your data type for CWF element? _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
maxis |
Posted: Wed Feb 02, 2005 6:21 am Post subject: |
|
|
Centurion
Joined: 25 Jun 2002 Posts: 144
|
thanks for responding. Message type is fixed format .... and its working now (earlier I was using incorrect CCSID).
Is there any diff in the following ESQL declaration ? how about memory allocation ?
-------------
int A ;
integer B ;
------------
cheers
M |
|
Back to top |
|
 |
kirani |
Posted: Thu Feb 03, 2005 11:56 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
No there is no difference. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
lerner |
Posted: Mon Aug 13, 2012 4:03 am Post subject: |
|
|
Apprentice
Joined: 17 May 2012 Posts: 26
|
Hi all,
I want email body as
TEST MAIL
secondline
set OutputRoot.XMLNSC.EmailBody.lastname='TEST MAIL';
set OutputRoot.XMLNSC.EmailBody.firstname='second line';
SET OutputLocalEnvironment.Destination.Email.BodyContentType ='text/html';
SET OutputRoot.BLOB.BLOB = CAST(OutputRoot.XMLNSC.EmailBody.lastname||', ||OutputRoot.XMLNSC.EmailBody.firstname as BLOB CCSID InputRoot.Properties.CodedCharSetId encoding InputRoot.Properties.Encoding);
but i tried with the suggested symbol
but it gave me error..please suggest me how to get new line in email body |
|
Back to top |
|
 |
lerner |
Posted: Mon Aug 13, 2012 4:10 am Post subject: |
|
|
Apprentice
Joined: 17 May 2012 Posts: 26
|
Thanks alexey...
got it by using below code
DECLARE CR CHAR CAST(CAST('X''0A''' AS BLOB) AS CHAR CCSID InputRoot.Properties.CodedCharSetId );
SET your_string = OutputRoot.XMLNSC.EmailBody.lastname||CR||OutputRoot.XMLNSC.EmailBody.firstname;
-- SET OutputLocalEnvironment.Destination.Email.BodyContentType = "text/html; charset=utf-8";
SET OutputRoot.BLOB.BLOB = CAST(your_string as BLOB CCSID InputRoot.Properties.CodedCharSetId encoding InputRoot.Properties.Encoding); |
|
Back to top |
|
 |
|