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 » Serialized object in C

Post new topic  Reply to topic
 Serialized object in C « View previous topic :: View next topic » 
Author Message
gmabrito
PostPosted: Wed Mar 20, 2002 2:56 pm    Post subject: Reply with quote

Apprentice

Joined: 19 Mar 2002
Posts: 35

I am trying write a program to handle a serialized object in C. Actually I would like this program to handle any kind of object within the queue. I want to be able to MQGET the message off a queue and print it to standard out, so I can redirect it to a file or pipe it to another program to put it on another queue. I tried using the defined MQBYTE array to handle this message data but it looks like it truncates the message when it gets to the serialized object. Any help would be appreciated.

Thanks,
Greg
Back to top
View user's profile Send private message
mrlinux
PostPosted: Thu Mar 21, 2002 6:58 am    Post subject: Reply with quote

Grand Master

Joined: 14 Feb 2002
Posts: 1261
Location: Detroit,MI USA

Are you getting a REason code of 2080 ????

_________________
Jeff

IBM Certified Developer MQSeries
IBM Certified Specialist MQSeries
IBM Certified Solutions Expert MQSeries
Back to top
View user's profile Send private message Send e-mail
gmabrito
PostPosted: Thu Mar 21, 2002 7:41 am    Post subject: Reply with quote

Apprentice

Joined: 19 Mar 2002
Posts: 35

No. I checked for that error code.

_________________
Thanks,
Greg
Back to top
View user's profile Send private message
kolban
PostPosted: Wed Mar 27, 2002 8:28 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

What makes you think the message was truncated? The content of the message is a red-herring. MQ by iyself doesn't care what is in the message. With a serialized C object as a message on the queue, use the MQExplorer browser to see how long the message is. Then, in your application, get the message and print out the length of the message returned. They should be the same. Ensure that you supply a buffer to the MQGET call large enough to hold your maximum expected message.
Back to top
View user's profile Send private message
StefanSievert
PostPosted: Wed Mar 27, 2002 10:33 am    Post subject: Reply with quote

Partisan

Joined: 28 Oct 2001
Posts: 333
Location: San Francisco

Hmmm, what are we talking about here? You say 'C' and you say 'serialized object'...!? Can you be a bit more specific about the scenario? Are you having an OO-Language (Java, C++, ??) written program on the sending side that serializes an object and puts the data to a queue, and a C (non-OO) program at the other end, that should handle the serialized object as binary data?
If this is the case and you talk about truncation, then I immediately think of C str.../printf functions and Hex Nulls. But as I really don't fully understand what you are tying to do, it might be totally off track.
I would at least assume that serialized objects WILL contain binary zeroes, so you might have trouble redirecting to stdout.
Cheers,
Stefan

_________________
Stefan Sievert
IBM Certified * WebSphere MQ
Back to top
View user's profile Send private message
gmabrito
PostPosted: Wed Mar 27, 2002 10:47 am    Post subject: Reply with quote

Apprentice

Joined: 19 Mar 2002
Posts: 35

YES. That is exactly the case. A Java program is creating the object, I just want to handle it, but I do not want to create a structure or data type to mimic the object. I just want to take whatever is in the queue remove it. I want my program to be generic enough so that the user can redirect the ouput to a file, to load to the queue later or pipe the output to another program to load it on a different queue.
Back to top
View user's profile Send private message
StefanSievert
PostPosted: Wed Mar 27, 2002 2:09 pm    Post subject: Reply with quote

Partisan

Joined: 28 Oct 2001
Posts: 333
Location: San Francisco

Thanks for the clarification. I guess in that case you have to be very careful about which C functions you use to handle the serialized object (BLOB), because of the aforementioned probability that the BLOB contains 0x00 values which are significant for some library functions (string handling, printf, sprintf, fprintf, etc.).
I still think that one of those NULLs is why you see a truncation. You could verify this by using a debugger to see what the message buffer after the MQGET contains at the position where the truncation occurs.
If I would be a gambling man...
Cheers,
Stefan

_________________
Stefan Sievert
IBM Certified * WebSphere MQ
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 » Serialized object in C
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.