Troubleshooting
Problem
Your IBM MQ application receives a 2080 (MQRC_TRUNCATED_MSG_FAILED). The application then resizes the buffer to handle the new message size. Intermittently the 2080 error is received again.
Symptom
2080 0x00000820 MQRC_TRUNCATED_MSG_FAILED
Cause
More than one application is getting messages from of the queue. Another application has received the message.
Resolving The Problem
Some solutions are:
1: Open the queue with exclusive access, so no other application can get the message.
2: Do an MQGET matching on the msgid and correlid. If a MQRC_NO_MSG_AVAILABLE is received then another application has handled the message.
3: Handle by resizing the buffer. Do not consider MQRC 2080 as an error since the message will be handled as soon as an application allocates a buffer that is large enough to process the message.
2: Do an MQGET matching on the msgid and correlid. If a MQRC_NO_MSG_AVAILABLE is received then another application has handled the message.
3: Handle by resizing the buffer. Do not consider MQRC 2080 as an error since the message will be handled as soon as an application allocates a buffer that is large enough to process the message.
.
++ Example of modifying amqsget in Linux.
.
Look at the source code for the amqsget sample, which is provided with MQ at:
/opt/mqm/samp/amqsget0.c
.
Notice that the buffer length is 64 KB:
.
MQBYTE buffer[65536]; /* message buffer */
.
Thus, it seems to me that a good candidate for explaining the problem that you are encountering is that the message that the sample fails to read has a payload that is greater than 64 KB.
/opt/mqm/samp/amqsget0.c
.
Notice that the buffer length is 64 KB:
.
MQBYTE buffer[65536]; /* message buffer */
.
Thus, it seems to me that a good candidate for explaining the problem that you are encountering is that the message that the sample fails to read has a payload that is greater than 64 KB.
To solve the problem you could modify the sample into a directory in your HOME and then modify:
.
a) To increase the buffer size to accommodate the lenght of the payload in your messages:
For example, the following increases the size to 1 MB:
MQBYTE buffer[1048576]; /* message buffer */
.
or
.
b) To indicate that it is OK to truncate the large message and consider it to be a successful read.
Add the following get option: MQGMO_ACCEPT_TRUNCATED_MSG
gmo.Options = MQGMO_WAIT /* wait for new messages */
| MQGMO_NO_SYNCPOINT /* no transaction */
| MQGMO_ACCEPT_TRUNCATED_MSG /* accept truncated msg */
| MQGMO_CONVERT; /* convert if necessary */
.
Then you can compile it as mentioned below:
.
https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.1.0/com.ibm.mq.dev.doc/q028460_.htm
IBM MQ 9.1.x / IBM MQ / Developing applications / Developing MQI applications with IBM MQ / Building a procedural application / Building your procedural application on Linux /
Preparing C programs in Linux
.
Note: To avoid confusion, the executable would be called: amqsget2
.
a) To increase the buffer size to accommodate the lenght of the payload in your messages:
For example, the following increases the size to 1 MB:
MQBYTE buffer[1048576]; /* message buffer */
.
or
.
b) To indicate that it is OK to truncate the large message and consider it to be a successful read.
Add the following get option: MQGMO_ACCEPT_TRUNCATED_MSG
gmo.Options = MQGMO_WAIT /* wait for new messages */
| MQGMO_NO_SYNCPOINT /* no transaction */
| MQGMO_ACCEPT_TRUNCATED_MSG /* accept truncated msg */
| MQGMO_CONVERT; /* convert if necessary */
.
Then you can compile it as mentioned below:
.
https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.1.0/com.ibm.mq.dev.doc/q028460_.htm
IBM MQ 9.1.x / IBM MQ / Developing applications / Developing MQI applications with IBM MQ / Building a procedural application / Building your procedural application on Linux /
Preparing C programs in Linux
.
Note: To avoid confusion, the executable would be called: amqsget2
Ensure that you have the environment variable: MQ_INSTALLATION_PATH
You can use to confirm: set | grep MQ_INS
If not, then you need to run the setmqenv command:
. /opt/mqm/bin/setmqenv -s
.
C client application, 64-bit, non-threaded
gcc -m64 -o amqsget2 amqsget0.c -I $MQ_INSTALLATION_PATH/inc -L $MQ_INSTALLATION_PATH/lib64 -Wl,-rpath=$MQ_INSTALLATION_PATH/lib64 -Wl,-rpath=/usr/lib64 -lmqic
.
You can use to confirm: set | grep MQ_INS
If not, then you need to run the setmqenv command:
. /opt/mqm/bin/setmqenv -s
.
C client application, 64-bit, non-threaded
gcc -m64 -o amqsget2 amqsget0.c -I $MQ_INSTALLATION_PATH/inc -L $MQ_INSTALLATION_PATH/lib64 -Wl,-rpath=$MQ_INSTALLATION_PATH/lib64 -Wl,-rpath=/usr/lib64 -lmqic
.
[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSYHRD","label":"IBM MQ"},"Component":"Application \/ API","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.1;9.0;8.0;7.5;7.1;7.0;6.0","Edition":"All Editions","Line of Business":{"code":"LOB45","label":"Automation"}}]
Product Synonym
WMQ MQ
Was this topic helpful?
Document Information
Modified date:
26 March 2019
UID
swg21220396