Author |
Message
|
sayan |
Posted: Wed Feb 27, 2008 6:08 am Post subject: Junk characters while fetching with MQGET |
|
|
Novice
Joined: 22 Feb 2008 Posts: 13
|
Hi,
When i view the messages in MQ explorer, in the properties for the message in the input queue the format field shows MQSTR. Does this mean that the Format option in MQMD was set to MQFMT_STRING during MQPUT?
This is related to a post i had posted earlier regarding junk characters.The third party application puts message in cp1250 format while our application supports only utf-8. So even if we don't use these format options during MQPUT or MQGET shouldn't we be getting atleast a message which is recognizable. Suppose we are giving a message say
"20177777793000230010888QM6000030002.2006112601230614 "
The output after MQGET call is as below
"òðñ÷÷÷÷÷÷ùóðñðñóððñððñõØãùðððñóðñðñKòððøðòð÷ñóð÷ôøùòòððø`ðò`ð÷@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@òððø`ðò`ð÷`ñôKð÷KõðKðôöððñ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Feb 27, 2008 6:11 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Are you getting with the convert option? |
|
Back to top |
|
 |
Vitor |
Posted: Wed Feb 27, 2008 6:34 am Post subject: Re: Junk characters while fetching with MQGET |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sayan wrote: |
This is related to a post i had posted earlier regarding junk characters. |
Did you follow the advice given in that post? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
sayan |
Posted: Wed Feb 27, 2008 5:48 pm Post subject: Junk characters while fetching with MQGET |
|
|
Novice
Joined: 22 Feb 2008 Posts: 13
|
Actually the problem for us is we are using pre defined functions which are a part of our own product application. We have to either use those functions or define our own from scratch which is a tedious job.
So i was thinking that even if those format options were not used, shouldn't we be getting some output resembling the actual message. Over here we are getting just junk characters.
Pls post your views on this one. |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Feb 27, 2008 6:34 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Have you tried looking at the messages on the queue using the amqsbcg sample? |
|
Back to top |
|
 |
Vitor |
Posted: Thu Feb 28, 2008 12:58 am Post subject: Re: Junk characters while fetching with MQGET |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sayan wrote: |
So i was thinking that even if those format options were not used, shouldn't we be getting some output resembling the actual message. Over here we are getting just junk characters.
|
No. Not if the message is unconverted. If the code pages are close/related and the message actually contains text then you might see something but that's a lot of ifs. I know what the format says, I can quote at least one example where the app was sending packed decimal but the format was MQFMT_STRING because all the samples the coder had seen used that so he did as well. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
sayan |
Posted: Mon Mar 03, 2008 4:19 am Post subject: Junk characters while fetching from mqget |
|
|
Novice
Joined: 22 Feb 2008 Posts: 13
|
Hi,
I tried the MQGMO_CONVERT option. But it dosen't seem to work. I will paste the block of code. Suggest modificartions. The third party application is sending the messages in cp150. Should we change the ccsid of our queue manager to cp1250 or let it remain as utf8 becuase our application works only in utf8?
Pls help
int GetMessageFromQueueWithHandle(MQHCONN Hconn, MQHOBJ Hobj, tbaCharPtrType mesg, MQLONG *reas_code)
{
MQLONG CompCode; /* Completion Code */
MQLONG Reason; /* Reason */
MQMD mdget = {MQMD_DEFAULT};
MQGMO GetMsgOpts = {MQGMO_DEFAULT};
MQLONG DataLength; /* output of MQGET ,contains the length of the input message */
MQLONG buflen ; /* input to MQGET , contains the length of the buffer in which the message is expected */
M_CHAR_DECL(buffer, 30000); /* input to MQGET, will contain the message */
buflen = sizeof(buffer) -1;
mdget.CodedCharSetId = MQCCSI_Q_MGR;
mdget.Encoding = MQENC_NATIVE;
memcpy(mdget.Format, MQFMT_STRING, (size_t)MQ_FORMAT_LENGTH);
/* to wait for 5 seconds for any incoming message */
GetMsgOpts.Options = MQGMO_WAIT + MQGMO_CONVERT;
GetMsgOpts.WaitInterval = 5000; /* wait for 5 seconds */
MQGET(Hconn, Hobj, &mdget, &GetMsgOpts, buflen, buffer, &DataLength, &CompCode,&Reason);
if(CompCode)
{
*reas_code = Reason;
return FAILURE;
}
buffer[DataLength] = '\0'; /* end string ready to use */
m_strcpy(mesg, buffer);
return SUCCESS;
} |
|
Back to top |
|
 |
Vitor |
Posted: Mon Mar 03, 2008 4:48 am Post subject: Re: Junk characters while fetching from mqget |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sayan wrote: |
Suggest modificartions. |
Why? The code looks good. Have you tried any of the suggestions made earlier in this post, like checking the message really is text with amqsbcg and the format is set to string? Do you know for certain at this point the message is convertable using the default options?
sayan wrote: |
The third party application is sending the messages in cp150. Should we change the ccsid of our queue manager to cp1250 or let it remain as utf8 becuase our application works only in utf8?
|
I'll assume a typo and they're being sent in cp1250. You should decide what code pages you want to use and set the queue managers accordingly. If your application only works in utf8 (and do you mean ulf8 or Unicode?) then presumably setting the queue manager to 1250 will cause it to fail. What will that get you?
Think through the problem and decide on a solution. Don't randomly change code or settings in the hope you'll hit the "right" combination. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
friedl.otto |
Posted: Mon Mar 03, 2008 6:20 am Post subject: Re: Junk characters while fetching with MQGET |
|
|
Centurion
Joined: 06 Jul 2007 Posts: 116
|
sayan wrote: |
The output after MQGET call is as below
"òðñ÷÷÷÷÷÷ùóðñðñóððñððñõØãùðððñóðñðñKòððøðòð÷ñóð÷ôøùòòððø`ðò`ð÷@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@òððø`ðò`ð÷`ñôKð÷KõðKðôöððñ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" |
That is SO EBCDIC/ASCII conversion poopy. _________________ Here's an idea - don't destroy semaphores unless you're certain of what you're doing! -- Vitor |
|
Back to top |
|
 |
|