MQOPEN给出错误2085,这是我之前没有的

时间:2017-07-03 18:13:55

标签: c ibm-mq

我一切正常,直到今天我在MQOPEN上遇到了错误     2085 MQRC_UNKNOWN_OBJECT_NAME

#include <stdio.h>   
#include <cmqc.h>    
#include <cmqxc.h>     
#include "dte_mq.h"    
#include <string.h>    
#include <stdlib.h>    

typedef struct tagDTE_QUEUE_DESCRIPTOR    
{    
    MQHOBJ handle;    
    int    IsSyncpointControled;    
} DTE_QUEUE_DESCRIPTOR, *PDTE_QUEUE_DESCRIPTOR;    

static MQHCONN sHConn = 0;    
static MQLONG  sCompCode = MQCC_OK;    
static MQLONG  sReason = MQRC_NONE;    
static int     sNumOpenQueues = 0;    
static PDTE_QUEUE_DESCRIPTOR sQueues = NULL;    
MQLONG   OpenCode;    
MQOD     od = {MQOD_DEFAULT};    /* Object Descriptor */    
MQMD     md = {MQMD_DEFAULT};    
MQPMO    pmo = {MQPMO_DEFAULT};    
MQLONG   O_options;/* MQCONNX options */    
MQCNO   Connect_options = {MQCNO_DEFAULT};    
/* Client connection channel */    
MQCD    ClientConn = {MQCD_CLIENT_CONN_DEFAULT};    



#define MAX_NUM_OPEN_QUEUES     10    



int dteMqOpen(const char *name, int *qd)    
{    
    MQLONG   options;     
    MQHOBJ   hObj;    
    int      i;    
    printf("SAM\n");    
    strncpy(od.ObjectName, name, MQ_Q_NAME_LENGTH);    
    printf("SAM2\n");    
    O_options = MQOO_INPUT_AS_Q_DEF + MQOO_FAIL_IF_QUIESCING;    
    printf("SAM3\n");    
    MQOPEN(sHConn, &od, O_options, &hObj, &sCompCode, &sReason);    
    printf("MQopen = %d and %d\n",sCompCode,sReason);    
    if (sCompCode != MQCC_OK)    
    {    
        printf("RETURN %d\n",DTE_MQR_FAILED);    
        return DTE_MQR_FAILED;    
   }    
   ++sNumOpenQueues;    
  *qd = 1;    
  for(i = 0; i < MAX_NUM_OPEN_QUEUES; i++)    
  {    
      printf("In the loop1\n");    
      if(sQueues[i].handle == -1)    
      {    
          *qd = i;    
          printf("QDESC1 = %d\n",qd);    
          sQueues[i].handle = hObj;    
          sQueues[i].IsSyncpointControled = 0;    
          break;    
     }    
     printf("In the loop\n");    
   }    
   printf("QDESC = %d\n",qd);    
   return DTE_MQR_OK;    
}    

函数调用是:

qd = -1;    
dteretopen = dteMqOpen(QName, &qd);    
printf ("Return code from dteMqOpen = %d\n",dteretopen);    
if (dteretopen ==0)    
{    
    printf("MQOPEN could not open MQ, check errpr log\n");    
    exit(99);    
}    
  

错误2085.但是几天之前没有出现这样的错误   连接正常,但MQOPEN失败

1 个答案:

答案 0 :(得分:2)

dteretopen = dteMqOpen(QName, &qd);

显然&#39; QName&#39;具有无效值。

您一直在发布有关同一程序的问题。显然,您没有MQ编程培训。您需要尽快获得一些MQ培训。网络和视频上也有很多很多信息。

为什么你没有进行一些基本的调试和输出&#39; QName?

在此处发布问题之前,您需要主动调试程序。我们不是来做你的工作。