Попробуйте использовать API IBM Websphere MQ: char *MQRC_STR (MQLONG ReasonCode)
Вот пример кода:
#include <cmqc.h>
#include <cmqstrc.h>
typedef MQHCONN QM_REF;
QM_REF connect(const std::string & QueueManagerName)
{
QM_REF theManager_ = -1;
MQLONG compCode, reasonCode;
MQCONN(const_cast<char *>(QueueManagerName.c_str()), &theManager_, &compCode, &reasonCode);
if (MQCC_FAILED == compCode)
{
std::cout << "Failed to connect to queue manager. Reason code is:" << MQRC_STR(reasonCode) << std::endl;
}
return theManager_;
}