Author |
Message
|
hunter2317 |
Posted: Thu Jan 29, 2009 2:03 pm Post subject: mqrc_format_error on sending to queue |
|
|
Newbie
Joined: 29 Jan 2009 Posts: 7
|
In using the below code to send to a queue, I'm getting an error 2110. The message is sent in mqstr format. Any help would be greatly appreciated. Thanks
Code: |
//Open the Queue to put my Request into
logEvent("OPENING REQUEST QUEUE", SETTINGS.get("REQUEST_QUEUE"));
queue = mqQueueManager.AccessQueue(SETTINGS.get("REQUEST_QUEUE"), MQOO_OUTPUT | MQOO_FAIL_IF_QUIESCING | MQOO_SET_ALL_CONTEXT);
//Create a new message object
message = MQSession.AccessMessage();
//Set the message ID
message.MessageId = (new Date().valueOf().toString() + " ").slice(0,24);
//Set the message type
message.MessageType = MQMT_REQUEST;
//Set the reply to queue manager name
message.ReplyToQueueManagerName = SETTINGS.get("REPLY_TO_QUEUE_MANAGER_NAME");
//Set the user id
message.UserId = SETTINGS.get("USER_ID");
//Set the queue to Reply to name
message.ReplyToQueueName = SETTINGS.get("REPLY_QUEUE");
//Set the application Data ID
message.ApplicationIdData = SETTINGS.get("APPLICATION_ID");
//Write the message
@if (@debug) logDebug("messageText", messageText); @end
message.WriteString(messageText);
//Set the format of the message to a string
message.Format = MQFMT_STRING;
//Put the message in the queue
@if (@debug) logDebug("SENDING TO REQUEST QUEUE", messageText); @end
queue.Put(message) |
|
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 29, 2009 2:25 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
MessageID isn't a string, it's a byte array. Treating it as a string can cause problems. Also setting your own one up is not best practice.
Be surprised if that was your problem though. Not astonished, but surprised. What code page is the message in, and what's the code page of the server you're using?
It's also unusual for a 2110 to be an error rather than a warning. Are you sure the message isn't actually being put, and ending up on the DLQ? I've seen a message being DLQ'd with a 2110 when the channel's set to convert, and can't do the conversion due to code page problems. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
hunter2317 |
Posted: Fri Jan 30, 2009 5:46 am Post subject: |
|
|
Newbie
Joined: 29 Jan 2009 Posts: 7
|
Sorry, the message is ending up in the DLQ. Message CCSID is 437. Queue manager CCSID is 437.[/i] |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jan 30, 2009 6:09 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
hunter2317 wrote: |
Sorry, the message is ending up in the DLQ. |
Gosh I'm good!
hunter2317 wrote: |
Message CCSID is 437. Queue manager CCSID is 437. |
Given that your code is setting up a request, I would theorise it's going someplace to elicit a response and the queue you're putting to is a remote queue. In the situation I'm thinking of, the remote queue manager isn't using 437, no conversion is available between 437 and this other page & the channel is set to do the conversion itself. The conversion fails & the MCA dead letters the message.
This is why channel conversion is not considered best practice. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
zpat |
Posted: Fri Jan 30, 2009 6:18 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
2110 occurs on MQGET, not MQPUT.
It must therefore be the channel conversion (in itself not best practise).
Check the message using a local queue, make sure the message data and the MQMD.CCSID are consistent and valid. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jan 30, 2009 6:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
zpat wrote: |
2110 occurs on MQGET, not MQPUT.
It must therefore be the channel conversion (in itself not best practise). |
Believe me, you get the message DLQ'd with 2110 (and a 2110 on MQPUT) if the channel conversion is on and the code pages don't match. Been there, seen that.
The reason I remember it is I guessed the problem straight off and told the 3rd party running the sender channe to change the channel definition, which failed to resolve the problem.
It transpired some days later that they had, as instructed, changed their channel definition. I'd said nothing about using this new definition to delete and redefine the channel, so they'd just changed the definition script like I said and retried putting the message.
Thankfully they were geographically some distance away.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jan 30, 2009 6:27 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Of course, all this may have nothing at all to do with the poster's problem!
Worth looking at as a starting place though. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
zpat |
Posted: Fri Jan 30, 2009 7:23 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
I would be amazed if RC 2110 was returned from a MQPUT call to the application making the MQPUT call.
Of course it can end up in the DLQ with DLHRC 2110 after the channel attempts to MQGET it with CONVERT from the transmit queue. |
|
Back to top |
|
 |
hunter2317 |
Posted: Mon Feb 02, 2009 6:08 am Post subject: |
|
|
Newbie
Joined: 29 Jan 2009 Posts: 7
|
Figured out the problem. In another section of code someone had set the MQFMT_STRING to "MQSTRbbb" when it should have been 'MQSTR '. After changing that it worked fine. Thanks for all your help. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Feb 02, 2009 6:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
hunter2317 wrote: |
when it should have been 'MQSTR '. |
No, it should be MQFMT_STRING!  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
hunter2317 |
Posted: Mon Feb 02, 2009 6:50 am Post subject: |
|
|
Newbie
Joined: 29 Jan 2009 Posts: 7
|
In javascript you can't use the built-in MQ constants, you have to declare the values in your script. We were declaring the wrong value for MQFMT_STRING. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Feb 02, 2009 6:53 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
If you can access the Jar files that contain the MQ API from within Javascript, you can access the MQ constant declarations.
You just may have to adjust the includes to use them. The situation you have reported is exactly the reason why nobody should ever declare their own version of the constants instead of using the predefined ones. You can never tell why they don't work without significant program archaeology. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Feb 02, 2009 6:56 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
hunter2317 wrote: |
In javascript you can't use the built-in MQ constants, you have to declare the values in your script. We were declaring the wrong value for MQFMT_STRING. |
Really?
My knowledge of Java is slightly worse than my knowledge of the dark side of the Moon (orbiting body, not the album which I know quite well), but if you can't use built in constants what is this saying to me:
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/com.ibm.mq.csqzaw.doc/uj13440_.htm
Anyone? Help? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
hunter2317 |
Posted: Mon Feb 02, 2009 7:08 am Post subject: |
|
|
Newbie
Joined: 29 Jan 2009 Posts: 7
|
Despite the name javascript is not actually related to Java. With javascript, like VBscript you have to use the MQSeries Automation Classes for ActiveX. According to the documentation:
"The Automation Classes constants are not available to VBScript and
JavaScript programs, so the programmer will have to hard code them (these
constants can be found in the cmqc.h header file provided with MQSeries
products)." |
|
Back to top |
|
 |
Vitor |
Posted: Mon Feb 02, 2009 7:16 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
hunter2317 wrote: |
Despite the name javascript is not actually related to Java. |
Ok. It's all dark technology to me.
I thought that ActiveX was depreciated. Or is that just the old ActiveX control? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|