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 » General IBM MQ Support » Reads \n as junk

Post new topic  Reply to topic
 Reads \n as junk « View previous topic :: View next topic » 
Author Message
Jyo
PostPosted: Thu Feb 08, 2007 2:18 am    Post subject: Reads \n as junk Reply with quote

Newbie

Joined: 08 Feb 2007
Posts: 6

Hi,

We have an application which writes a message into the AS400 MQ. The CCSID for the message is set as 37.
The mesage is being read and written as a bytes message.
The destination interprets the new line characters as some junk and not as '\n'

Can anyone help me with this?

Thanks.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Feb 08, 2007 2:21 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Are you sending windows line endings, that are "\n\r", instead of just "\n", like they are on Unix?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Jyo
PostPosted: Thu Feb 08, 2007 2:34 am    Post subject: Reply with quote

Newbie

Joined: 08 Feb 2007
Posts: 6

No we are sending a "\n" only
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Feb 08, 2007 2:46 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Well, then I guess you're reading the message as a bytes message and \n as written by the sending application is not \n in codepage 37.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Jyo
PostPosted: Thu Feb 08, 2007 2:52 am    Post subject: Reply with quote

Newbie

Joined: 08 Feb 2007
Posts: 6

So how can I solve the problem now? The limitation of the destination is it can read only byte messages
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Feb 08, 2007 3:02 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

There are several best practices for passing text based data between systems using MQ.

Apparently, someone has designed your system to not use any of those.

Therefore, you must write your code to deal with the message that you're given. This means, for example, deciding what codepage the data is in, and converting any necessary characters into the right codepage that you need to work with.

If the program that is reading these messages is already locked in, and you can't change any aspect of it at all, you will have to write another program to adapt the data from the sending applications to what the receiving application can handle.

The only other viable option is to instruct every application that is sending data to this AS400 machine to only send data that is already properly in codepage 37, including the \n. This is a horrible idea, and will plague you the rest of your days if you implement.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Thu Feb 08, 2007 7:27 am    Post subject: Reply with quote

Guest




More information please: the message is coming from another qmgr or client, AND the other platform has a different CCSID than 037 on the iseries (as/400)?

If the message is inbound from a Windows/intel platform with ccsid of 437, then either the sender channel needs the CONVERT(YES) attribute OR the MQGETting application needs to specify MQGMO_CONVERT to drive the conversion from one ccsid to the other.
Back to top
tleichen
PostPosted: Thu Feb 08, 2007 7:37 am    Post subject: Reply with quote

Yatiri

Joined: 11 Apr 2005
Posts: 663
Location: Center of the USA

I've worked with several platforms and codepages over the years and I have found that the biggest problems occur when people try to go against the grain with regard to messaging and codepage conversion. In 99.99% of the cases I've seen, there is a simple solution built into MQ for converting the message with transparency to the application(s). All one needs to do is to learn how MQ works before they write applications.

I know that seems to be asking a lot these days...
_________________
IBM Certified MQSeries Specialist
IBM Certified MQSeries Developer
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Feb 08, 2007 8:02 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

bruce2359 wrote:
If the message is inbound from a Windows/intel platform with ccsid of 437, then either the sender channel needs the CONVERT(YES) attribute OR the MQGETting application needs to specify MQGMO_CONVERT to drive the conversion from one ccsid to the other.


ONLY if the MQMD.Format == MQFMT_string.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Jyo
PostPosted: Fri Feb 09, 2007 1:41 am    Post subject: Reply with quote

Newbie

Joined: 08 Feb 2007
Posts: 6

Hi,

Here we write the message from an NT machine onto the AS400 MQ.
We used the JMS API to write the message.

We have set the CCSID as 37 on the message using:

myBytesMessage.setIntProperty("JMS_IBM_Character_Set", 37);

myBytesMessage.setIntProperty("JMS_IBM_Encoding", 273);

myBytesMessage.setStringProperty("JMS_IBM_Format", "MQSTR");
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Feb 09, 2007 2:34 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

See, THERE you are using JMS.

And I said "Use a TextMessage, not a BytesMessage".

And what you're trying to do there, is send data that is already properly in codepage 37. I repeat.

This is a horrible idea and it will plague you the rest of your days if you implement it.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Jyo
PostPosted: Fri Feb 09, 2007 4:16 am    Post subject: Reply with quote

Newbie

Joined: 08 Feb 2007
Posts: 6

I am sorry for the confusion, it was a text message only and not a bytes message
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Feb 09, 2007 4:34 am    Post subject: Reply with quote

Grand High Poobah

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

Jyo wrote:
I am sorry for the confusion, it was a text message only and not a bytes message

You are going about it the entire wrong way.

Send a text message.
Don't set any properties. You'd only be setting them the wrong way.

What you CAN do however is set the ccsid in the JNDI for the destination. Set that to 37 and your message will get converted to CCSID 37 before hitting the queue. The receiver should be able to confirm that.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Jyo
PostPosted: Mon Feb 12, 2007 7:14 am    Post subject: Reply with quote

Newbie

Joined: 08 Feb 2007
Posts: 6

Hi,

We set the CCSID to 37 in a properties file and then use that properties file, instead of directly setting it at the Websphere Queue configuration level.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Feb 12, 2007 3:58 pm    Post subject: Reply with quote

Grand High Poobah

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

The only way to set it correctly is in the JNDI layer. Either in a static manner or using the URI form when creating the queue.

Anything else will require you to effectively translate the content of the message before putting it...

Enjoy
_________________
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 » General IBM MQ Support » Reads \n as junk
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.