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 » COnvert ^M to CRLF

Post new topic  Reply to topic
 COnvert ^M to CRLF « View previous topic :: View next topic » 
Author Message
protocol
PostPosted: Mon Feb 16, 2009 12:36 pm    Post subject: COnvert ^M to CRLF Reply with quote

Apprentice

Joined: 25 Feb 2005
Posts: 41

Hello,
We are getting a BLOB from Mainframe, our Broker runs on AIX and we make a Http Request to Windows.

The Http Request seems to be failing and the reason is because the CDATA section has ^M's, where it should have been CRLF placing the various items in the CDATA section in different lines.

How can I remove the ^M's and send it as CRLF to windows?

Any help is appreciated.

Thanks!
Back to top
View user's profile Send private message
Tibor
PostPosted: Mon Feb 16, 2009 1:32 pm    Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

Just use the REPLACE function in the BLOB domain:
Code:
SET OutputRoot.BLOB.BLOB = REPLACE(InputRoot.BLOB.BLOB, X'0d', X'0d0a');
Back to top
View user's profile Send private message
protocol
PostPosted: Mon Feb 16, 2009 1:58 pm    Post subject: Reply with quote

Apprentice

Joined: 25 Feb 2005
Posts: 41

Tibor,
Thank you very much!! That worked!!
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Feb 16, 2009 3:03 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

It works until you get a message that already has 0x0d0x0a in it, yes.

Perhaps you should entirely rethink your approach of embedding formatted, meaningful data inside XML as an unformatted, meaningless CDATA section.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Mon Feb 16, 2009 5:35 pm    Post subject: Re: Convert CR to CRLF Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

protocol wrote:
Hello,
We are getting a BLOB from Mainframe, our Broker runs on AIX and we make a HttpRequest to Windows.

The HttpRequest seems to be failing and the reason is because the CDATA section has ^M's, where it should have been CRLF placing the various items in the CDATA section in different lines.

XML parsers usually try to normalize end-of-line terminators automatically, (including within CDATA segments).

This is but one benefit that makes them a bit more useful than BLOB parsers, when processing XML messages.
Back to top
View user's profile Send private message
Tibor
PostPosted: Tue Feb 17, 2009 2:51 am    Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

mqjeff wrote:
It works until you get a message that already has 0x0d0x0a in it, yes.

I don't understand it, because 0x0d0x0a is not a valid BLOB fragment.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 17, 2009 3:15 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Tibor wrote:
mqjeff wrote:
It works until you get a message that already has 0x0d0x0a in it, yes.

I don't understand it, because 0x0d0x0a is not a valid BLOB fragment.


Sorry, change in nomenclature. If you run the replace against a message that already has X'0d0a' instead of just X'0d', you will get X'0d0a0a'.
Back to top
View user's profile Send private message
Tibor
PostPosted: Tue Feb 17, 2009 3:23 am    Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

To avoid this scenario, should transform in 2 steps:
1. replace CRLF to LF
2. replace LF to CRLF

On a first view it seems a little bit strange, but can work without the duplication problem.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 17, 2009 3:31 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Tibor wrote:
To avoid this scenario, should transform in 2 steps:
1. replace CRLF to LF
2. replace LF to CRLF

On a first view it seems a little bit strange, but can work without the duplication problem.


Yes,but again. Protocol should perhaps reconsider how the data being passed is packaged...
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Feb 17, 2009 3:51 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

read also http://www.mqseries.net/phpBB2/viewtopic.php?t=47639
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » COnvert ^M to CRLF
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.