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 » IBM MQ Java / JMS » Weird Characters when Putting a Message to a Queue

Post new topic  Reply to topic
 Weird Characters when Putting a Message to a Queue « View previous topic :: View next topic » 
Author Message
Matrin
PostPosted: Thu Feb 21, 2008 9:18 am    Post subject: Weird Characters when Putting a Message to a Queue Reply with quote

Novice

Joined: 14 Feb 2008
Posts: 10

Hi folks,

I am having a Java program that reads from a socket and puts the data in a queue. I have noticed that the message being put in the queue could not be read, and it has a weird characters at the beginning.

At first i suspected that this character might have came from the data being read from the socket. but when trying to hard-code some data and putting it in the queue, the same characters appeared.

I really dont know what is the problem..
and really need your help


Thanks
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Feb 21, 2008 9:22 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

us to you.

Show your code. Post a sample of the "weird" characters.

Describe your problem in detail.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Matrin
PostPosted: Fri Feb 22, 2008 1:48 am    Post subject: Reply with quote

Novice

Joined: 14 Feb 2008
Posts: 10

Hey Jef...

Here is part of the code which i believe causes the problem...

The charecters are .| and .[

Code:


 private boolean SBBATMCORESendMQ(String myMessage){
   boolean bReturn = false;

   try {

 int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;

MQQueue que_OutputQue = m_qMgr.accessQueue("MQ.OUT", openOptions);

MQMessage msg_Message = new MQMessage();

msg_Message.expiry = m_iQMessageExpiry;

msg_Message.writeUTF(myMessage);

 MQPutMessageOptions pmo = new MQPutMessageOptions();


 que_OutputQue.put(msg_Message, pmo);

  que_OutputQue.close();

  }

.
.
.
.
.

Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Feb 22, 2008 1:51 am    Post subject: Re: Wiered Characters when Putting a Message to a Queue Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Matrin wrote:
I have noticed that the message being put in the queue could not be read, and it has a wiered characters at the begennig.


Could not be read why? MQ reason code? If so what?

If the message could not be read, by what means are you seeing the wierd characters?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
zpat
PostPosted: Fri Feb 22, 2008 2:08 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Apart from anything else, it is bad practice to open an output queue for input + output.

Why? Just wait until you try and use a remote queue def and then you will find out!

Use WriteString or Text or whatever is the correct language construct.

If you use UTF, you must expect Byte Order Mark characters to appear at the start (and the CCSID will probably not match the data).

BOM, BOM ! as they say....
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Feb 22, 2008 2:37 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

zpat wrote:
If you use UTF, you must expect Byte Order Mark characters to appear at the start (and the CCSID will probably not match the data).

BOM, BOM ! as they say....


Good point I say!!

The "weird characters" probably are the UTF header.

Be sure you read the message with the matching method - if you use writeUTF you must use readUTF, if you use writeText use readText and so forth.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Feb 22, 2008 4:26 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You never want to use write/readUTF unless you know exactly what they do, and exactly what UTF is, and how it's different than Unicode.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Matrin
PostPosted: Sun Feb 24, 2008 3:49 am    Post subject: Reply with quote

Novice

Joined: 14 Feb 2008
Posts: 10

Heey guys,

Thanks for your comments...

I tried using write string and it worked

thanks alot
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Feb 24, 2008 6:04 am    Post subject: Reply with quote

Grand High Poobah

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

Matrin wrote:
Heey guys,

Thanks for your comments...

I tried using write string and it worked

thanks alot


As well make sure if your message is all String to set the format to MQFMT_STRING

_________________
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 » IBM MQ Java / JMS » Weird Characters when Putting a Message to a Queue
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.