【发布时间】:2019-06-28 22:24:27
【问题描述】:
如何将 IBM Websphere MQseries 的原因代码转换/查找为其解释(用于日志记录等)?
【问题讨论】:
如何将 IBM Websphere MQseries 的原因代码转换/查找为其解释(用于日志记录等)?
【问题讨论】:
请参阅SupportPac MA0K,它有 C 和 Visual Basic 代码来执行此任务。
【讨论】:
从命令行有“mqrc.exe”,它与 MQSeries 一起提供,它返回符号常量名称。
对于 Java,com.ibm.mq.jmqi.jar 中包含 MQConstants.lookupReasonCode(reasonCode)
【讨论】:
尝试使用 IBM Websphere MQ api: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_;
}
【讨论】: