ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Embedding a line feed using ESQL

Post new topic  Reply to topic
 Embedding a line feed using ESQL « View previous topic :: View next topic » 
Author Message
MillsPerry
PostPosted: Wed Apr 03, 2002 2:30 pm    Post subject: Reply with quote

Acolyte

Joined: 08 Oct 2001
Posts: 59
Location: ZyQuest, inc.

I need to use a compute node to embed a line feed into a string field. I could not find a suitable function in my ESQL manual. Has anybody figured out a way to do this?

TIA,

Mills Perry
Back to top
View user's profile Send private message Send e-mail
kolban
PostPosted: Wed Apr 03, 2002 3:13 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

Append using the '||' operation a casted blob representing the linefeed ...

e.g.

set string = originalString || cast(x'0D' as char);
Back to top
View user's profile Send private message
kolban
PostPosted: Thu Apr 04, 2002 5:53 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

Correct ... XML is composed of printable characters only. You can't put control characters into an XML document. This is by design of the XML specification.

Why would you want a control character in your XML data?

[ This Message was edited by: kolban on 2002-04-04 05:53 ]
Back to top
View user's profile Send private message
MillsPerry
PostPosted: Thu Apr 04, 2002 1:47 pm    Post subject: Reply with quote

Acolyte

Joined: 08 Oct 2001
Posts: 59
Location: ZyQuest, inc.

Why would I want a linefeed in my XML?

Simple. Because the application that will read my XML [b]wants[b] a line feed within the text field I am sending it. Why does a chicken cross the road?
Back to top
View user's profile Send private message Send e-mail
CodeCraft
PostPosted: Sun Jun 16, 2002 2:07 pm    Post subject: Reply with quote

Disciple

Joined: 05 Sep 2001
Posts: 195

The trick here is to get CrLf into a variable and then use it. You can't do this by casting, because you end up with a literal string which reads:

X'0D' (that is, all five characters are in the string).

To get a CRLF into a variable, do this:

Set up a compute to create a dummy message:

--------------------------------------------------------------------------------
/*
* Create, as binary, an XML message with appended with CRLF.
* This equates to "<crlf/>[cr][lf]".
*/
set OutputRoot."BLOB"."BLOB" = X'3C63726C662F3E0D0A';
--------------------------------------------------------------------------------

Use RCD to recast this BLOB to XML. Then in a subsequent compute:

declare CrLf character;
set CrLf = InputRoot.XML.*[2];

This works because the generic XML parser has been written to preserve
white space, so once it's in the tree, you can get at it.

You'll need to use the DestinationList (2.02) or LocalEnvironment (2.1)
to pass other stuff along through the few nodes you use while you get
the CRLF sorted.

Alternatively, if you already have XML input which is guaranteed to have
a CRLF at a fixed (known) point each time, you can access that, or, you
can write a CRLF to a database table and retrieve it.
Back to top
View user's profile Send private message
Nyusser
PostPosted: Tue Jul 02, 2002 5:47 am    Post subject: Reply with quote

Apprentice

Joined: 02 Jul 2002
Posts: 48

The simplest way to add a linefeed at the end of an other string is the following:

DECLARE lf CHARACTER;

SET lf = CAST( x'0D' AS CHAR CCSID 819);

where 819 should be replaced by the CCSID of your broker's queue manager. The CCSID part does the trick - without CCSID part the x'0D is converted to string 0D instead of the line feed character.
Back to top
View user's profile Send private message
CodeCraft
PostPosted: Tue Jul 02, 2002 8:35 am    Post subject: Reply with quote

Disciple

Joined: 05 Sep 2001
Posts: 195

One thing to be careful of:

If you are putting this into XML, the XML spec. says that all line feeds (CR,CRLF,LF) held by the application (ie: WMQI) should be as x'0A', so you need to append x'0A' to your string. [Looking for CRLF in a parsed XML string would be a waste of time!]

For non-XML data, if you want just LF, use x'0A', just CR, use x'0D', or CRLF, use x'0D0A'.

Cheeky for someone who didn't know how to do this last week!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Embedding a line feed using ESQL
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.