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 API Support » Message format problem

Post new topic  Reply to topic
 Message format problem « View previous topic :: View next topic » 
Author Message
fil
PostPosted: Mon Jan 15, 2007 12:17 am    Post subject: Message format problem Reply with quote

Newbie

Joined: 12 Jan 2007
Posts: 3
Location: Germany

I have written a MQ application some years ago (MQ 5.3, DEC Alpha
TRU64 UNIX, Perl-based) for sending an receiving messages. For test
purposes I'm used a C++ application (same version and platform)
simulating the other side of communication.
Now I "ported" the MQ application to a Linux x86 platform (MQ 6.0.0.0, RedHat 3).
While testing the communication against the old simulator I got following
problem on simulator side:
Getting the message from the Queue results in an "Non-text message" error.
Afterwards I uses IBMs sample applications (amqsget0.c and imqsget.cpp) as simulator
with following effect:
With amqsget0 the message can read (MQGET) from the queue,
but using imqsget I got the same error.
The only modification in amqsget0 was to extend the buffer size
(avoiding Reason Code 2080).
In imqsget I have added following four lines just after getting the
message (and also resized the buffer):

Code:
char buffer[ 800 + 1 ];          /* Message buffer                */
 /* ...*/
if ( queue.get( msg, gmo ) ) {

      int iDataLength = msg.dataLength();                     /* 1 */
      printf("message of length %d received\n", iDataLength); /* 2 */
      buffer[ msg.dataLength( ) ] = 0 ;                       /* 3 */
      printf( "message <%s>\n", msg.bufferPointer( ) );       /* 4 */
     
      /**************************************************************/
      /*   Display each message received                            */
      /**************************************************************/
      if ( msg.formatIs( MQFMT_STRING ) ) {

        buffer[ msg.dataLength( ) ] = 0 ;  /* add terminator          */
        printf( "message <%s>\n", msg.bufferPointer( ) );

      } else {
        printf( "Non-text message\n" );
      }

    } else {
      /* ... */

The output of both additional printf's [2,4] are identical to output from amqsget0 (what I expect).
Nevertheless the format check "if ( msg.formatIs( MQFMT_STRING ) ) {" goes into the else branch,
"Non-text message".

I can't see any difference between amqsget0 and imqsget resulting into the problem described.

Any help would be great, thanks.
Frank
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jan 15, 2007 3:13 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

First off, the constant MQFMT_STRING might be declared as MQC.MQFMT_STRING or etc. in the C++ environment - you should double-check the Using C/C++ manual to see what it says about constants.

Second, it could be that the message really doesn't have Format = MQFMT_STRING. You should use amqsbcg or amqsbcgc to look at the message on the queue and see what the format and the data actually are.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fil
PostPosted: Mon Jan 15, 2007 6:29 am    Post subject: Reply with quote

Newbie

Joined: 12 Jan 2007
Posts: 3
Location: Germany

Hi,

The MQC.MQFMT_STRING is defined as "MQSTR ", and
MQC.MQFMT_NONE as " " (8 spaces).

I have repeated the test on both environments (DEC Alpha - DEC Alpha
and Linux - DEC Alpha) and printed the messages using amqsbcg:

1. Test DEC Alpha - DEC Alpha
Sender:
Code:
Format : 'MQXMIT  '
/*...*/
00000080:  2202 0000 3303 0000 4D51 5354 5220 2020 '"...3...MQSTR   '


Receiver:
Code:
Format : 'MQSTR   '


2. Test Linux - DEC Alpha
Sender:
Code:
Format : 'MQXMIT  '
/* ... */
00000080:  2202 0000 3303 0000 2020 2020 2020 2020 '"...3...        '


Receiver:
Code:
Format : '        '


The difference I have found is that the MQFMT string was not written into the message (on Linux).
I think this would causes the problem I have.
Do you have any idea about the reason?

Thanks
Frank.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jan 15, 2007 6:34 am    Post subject: Reply with quote

Grand High Poobah

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

fil wrote:
Do you have any idea about the reason?


In the Linux example, the putting application isn't setting it?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jan 15, 2007 6:35 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

What I meant was that your code might have to say "MQC.MQFMT_STRING", rather than just "MQFMT_STRING" in order to get the right constant value.

Also, yes, if the Format field does not contain a Format of "MQSTR ", then the message won't be treated as string data.

So that *is* your problem, and you need to figure out why.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Jan 15, 2007 6:56 am    Post subject: Reply with quote

Grand High Poobah

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

and you really want to use MQC.MQFMT_STRING because the variable format is fixed string 8 char long which does not match "MQSTR" !

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
fil
PostPosted: Tue Jan 16, 2007 3:01 am    Post subject: Reply with quote

Newbie

Joined: 12 Jan 2007
Posts: 3
Location: Germany

Yes, the usage of the constant MQC.MQFMT_STRING was incorrect.

We using a Perl wrapper for the MQ libraries, so it tooks a
while to find out the right place for a correction
(and how to solve it).
But now everything works fine.

Many thanks for your help.
Frank.
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 » IBM MQ API Support » Message format problem
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.