C++ 如何将MQseries原因代码转换为字符串?
如何将IBM Websphere MQseries的原因码转换/查找为其解释(用于日志记录等)?请查看哪个有C和Visual Basic代码来执行此任务。从命令行可以看到随MQseries提供的“mqrc.exe”,它返回符号常量名称C++ 如何将MQseries原因代码转换为字符串?,c++,c,ibm-mq,C++,C,Ibm Mq,如何将IBM Websphere MQseries的原因码转换/查找为其解释(用于日志记录等)?请查看哪个有C和Visual Basic代码来执行此任务。从命令行可以看到随MQseries提供的“mqrc.exe”,它返回符号常量名称 对于Java,有MQConstants.lookupReasonCode(reasonCode),它包含在com.ibm.mq.jmqi.jar中尝试使用ibm Websphere mq api:char*MQRC_STR(MQLONG reasonCode) 以
对于Java,有MQConstants.lookupReasonCode(reasonCode),它包含在com.ibm.mq.jmqi.jar中尝试使用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_;
}
#包括
#包括
类型定义MQHCONN QM_REF;
QM_REF connect(const std::string和QueueManagerName)
{
QM_REF the manager_u=-1;
MQLONG compCode,reasonCode;
MQCONN(const_cast(QueueManagerName.c_str())、管理器、compCode和reasonCode);
if(MQCC_FAILED==compCode)
{
std::太好了!我想知道在哪里可以找到它--为我节省了大量的工作,@T.RobWhy the down vote?这显示了如何使用IBM MQ的最新版本中添加的函数,而在2010年提出这个问题时,该版本并不存在。将stdout用于错误报告是一个主要的反模式:(这就是stderr的用途)。