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 » How to generate line feed and cartridge for a string

Post new topic  Reply to topic
 How to generate line feed and cartridge for a string « View previous topic :: View next topic » 
Author Message
lium
PostPosted: Thu Jul 08, 2010 6:15 am    Post subject: How to generate line feed and cartridge for a string Reply with quote

Disciple

Joined: 17 Jul 2002
Posts: 184

I would like to output a XML element which includes 0x0a0d(line feed, cartridge). Let me say :
DECLARE firstName CHAR 'David';
DECLARE lastName CHAR 'Bond';

SET OutputRoot.XMLNSC.Result.Name = firstNmae || lastName;

I would like Name includes 0x0a0d between first name and last name.
How can I do to obtain that?

Thanks,
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Thu Jul 08, 2010 7:36 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

First take the sellophane wrap off of the cartridge.

Then try this code:

Code:

DECLARE firstName CHAR 'James';
DECLARE lastName CHAR 'Bond';
DECLARE title CHAR 'double oh seven';
DECLARE CR CHAR CAST(CAST('X''0D''' AS BLOB) AS CHAR CCSID ...);
DECLARE LF CHAR CAST(CAST('X''0A''' AS BLOB) AS CHAR CCSID ...);

SET OutputRoot.XMLNSC.Result.Name = firstNmae || lastName || title || CR || LF;


Ciao'
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
lium
PostPosted: Thu Jul 08, 2010 9:54 am    Post subject: Reply with quote

Disciple

Joined: 17 Jul 2002
Posts: 184

Really appreciate.
I tested and it worked!
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Jul 08, 2010 11:20 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I would not bother putting in the carriage return ( or the cartriidge, if you prefer ). Any proper XML parser will throw it away, so the application that reads your XML will only ever see a single line feed (0x0A ).
Back to top
View user's profile Send private message
lium
PostPosted: Thu Jul 08, 2010 11:25 am    Post subject: Reply with quote

Disciple

Joined: 17 Jul 2002
Posts: 184

Tx for reply Kimbert.
The data is to be used by pdf generator.
The reason I put it worked was because I saw 2 lines in the output pdf.
Back to top
View user's profile Send private message
mgk
PostPosted: Thu Jul 08, 2010 12:20 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Not a big problem, but this code is a little inefficient:

Code:
DECLARE CR CHAR CAST(CAST('X''0D''' AS BLOB) AS CHAR CCSID ...);


As the original data could just be a BLOB literal, there is no need to CAST it to BLOB, so the better code would be:

Code:
DECLARE CR CHAR CAST( X'0D' AS CHAR CCSID ...);


Once we have done this we quickly realise that if we are always adding a CR and an LF together we may as well do it in one step like this:

Code:
DECLARE CRLF CHAR CAST( X'0D0A' AS CHAR CCSID ...);


And use it like this:

Code:
SET OutputRoot.XMLNSC.Result.Name = firstNmae || CRLF || lastName;



Kind 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
View user's profile Send private message
lancelotlinc
PostPosted: Thu Jul 08, 2010 12:23 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Yes much more efficient. But you forgot the title. Mr. Bond would not be pleased. Everyone calls him by his title.

Code:

DECLARE title CHAR 'double oh seven';
SET OutputRoot.XMLNSC.Result.Name = firstName || lastName || title || CRLF;

_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Thu Jul 08, 2010 12:59 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

lancelotlinc wrote:
Yes much more efficient. But you forgot the title. Mr. Bond would not be pleased. Everyone calls him by his title.

Code:

DECLARE title CHAR 'double oh seven';
SET OutputRoot.XMLNSC.Result.Name = firstName || lastName || title || CRLF;


Then shouldn't it be
Code:
Set OutputRoot.XMLNSC.Result.name = lastName||', '||firstName||lastName||title||CRLF;
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Jul 08, 2010 3:16 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
The data is to be used by pdf generator.
The reason I put it worked was because I saw 2 lines in the output pdf.
Yes - and the output of XMLNSC probably contains the CRLF. But if the pdf generator uses a real XML parser, only the linefeed will get past it.
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 » How to generate line feed and cartridge for a string
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.