|   | 
	 
  
    | 
RSS Feed - WebSphere MQ Support
 | 
RSS Feed - Message Broker Support
 |   
 
  
	|  PCF commands, where are the replies??? | 
	« View previous topic :: View next topic »  | 
   
  
  	
	  
		
		
		  | Author | 
		  Message
		 |  
		
		  | ryno | 
		  
		    
			  
				 Posted: Mon Jul 22, 2002 6:01 am    Post subject: PCF commands, where are the replies??? | 
				     | 
			   
			 
		   | 
		 
		
		    Novice
 
 Joined: 22 Jul 2002 Posts: 17
  
  | 
		  
		    
			  
				| I know the name of the default qmgr, but i want to test pcf commands.  I have the c program putting a command (INQUIRE_Q_MGR)on the SYSTEM.ADMIN.COMMAND.QUEUE but where do I find the response to this command, I thought it was COMMAND.RESPONSE.LOCAL but I dont even see that queue when I WRKMQMQM(as400).  Where would I find replies to the pcf commands?  thanks | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | mrlinux | 
		  
		    
			  
				 Posted: Mon Jul 22, 2002 6:13 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Grand Master
 
 Joined: 14 Feb 2002 Posts: 1261 Location: Detroit,MI USA 
  | 
		  
		    
			  
				when you place the command on the queue you need to specify replytoq and replytoqmgr. Thats how it knows to where to respond . _________________ Jeff 
 
 
IBM Certified Developer MQSeries
 
IBM Certified Specialist MQSeries
 
IBM Certified Solutions Expert MQSeries | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | ryno | 
		  
		    
			  
				 Posted: Mon Jul 22, 2002 10:33 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Novice
 
 Joined: 22 Jul 2002 Posts: 17
  
  | 
		  
		    
			  
				Im thinking I have it set correctly, but if I look into the queue there are no messages.  does this look correct?
 
 
#define  COMMAND_QUEUE "SYSTEM.ADMIN.COMMAND.QUEUE" 
 
#define  RESPONSE_QUEUE "SYSTEM.ADMIN.RESPQ.QDEL"   
 
....
 
 MsgDesc.Persistence    = MQPER_NOT_PERSISTENT;                
 
 memset( MsgDesc.ReplyToQMgr, '\0', MQ_Q_MGR_NAME_LENGTH );   
 
 MsgDesc.MsgType  = MQMT_REQUEST;                             
 
                                                              
 
 MsgDesc.Report   = MQRO_PASS_CORREL_ID;                      
 
 memcpy(MsgDesc.MsgId, MQMI_NONE, sizeof(MsgDesc.MsgId));     
 
 strcpy(MsgDesc.CorrelId, "QueueDel");                        
 
                                                              
 
 memcpy( MsgDesc.ReplyToQ, RESPONSE_QUEUE, MQ_Q_NAME_LENGTH );
 
 memcpy( MsgDesc.Format, MsgFormat, MQ_FORMAT_LENGTH ); 
 
 
thanks | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | mrlinux | 
		  
		    
			  
				 Posted: Mon Jul 22, 2002 10:41 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Grand Master
 
 Joined: 14 Feb 2002 Posts: 1261 Location: Detroit,MI USA 
  | 
		  
		    
			  
				I would try changing the following :
 
 
 
From
 
memset( MsgDesc.ReplyToQMgr, '\0', MQ_Q_MGR_NAME_LENGTH ); 
 
To
 
memset( MsgDesc.ReplyToQMgr, ' ', MQ_Q_MGR_NAME_LENGTH ); 
 
 
 
From 
 
memcpy( MsgDesc.ReplyToQ, RESPONSE_QUEUE, MQ_Q_NAME_LENGTH ); 
 
 
TO
 
memcpy( MsgDesc.ReplyToQ, RESPONSE_QUEUE, strlen(RESPONSE_QUEUE)+1 ); _________________ Jeff 
 
 
IBM Certified Developer MQSeries
 
IBM Certified Specialist MQSeries
 
IBM Certified Solutions Expert MQSeries | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | muralidhar | 
		  
		    
			  
				 Posted: Mon Jul 22, 2002 11:55 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Acolyte
 
 Joined: 28 Feb 2002 Posts: 50
  
  | 
		  
		    
			  
				| Check Dead Letter Queue. Check if you have proper authority to put messages on reply to Q. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | ryno | 
		  
		    
			  
				 Posted: Mon Jul 22, 2002 12:14 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Novice
 
 Joined: 22 Jul 2002 Posts: 17
  
  | 
		  
		    
			  
				I dont see any messages in the SYSTEM.DEAD.LETTER.QUEUE, 
 
 can I email you the program, maybe that would give you a better idea.  thanks alot[/code] | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | muralidhar | 
		  
		    
			  
				 Posted: Mon Jul 22, 2002 12:37 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Acolyte
 
 Joined: 28 Feb 2002 Posts: 50
  
  | 
		  
		    
			  
				| Please send me the program. Let us see if I can find out the solution. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | mqonnet | 
		  
		    
			  
				 Posted: Tue Jul 23, 2002 4:45 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Grand Master
 
 Joined: 18 Feb 2002 Posts: 1114 Location: Boston, Ma, Usa. 
  | 
		  
		    
			  
				Do you see a message in the SYSTEM.ADMIN.COMMAND.QUEUE.  Is your command server running.  If yes, then do you see any activity, meaning messages(pcf) being processed.
 
Also check the output of DIS QMGR.  Not necessarily your SYSTEM.DEAD.LETTER.QUEUE be the default deadq.  Check for the appropriate one and go from there.
 
Also look up in the mqerror logs to see if anything in there.
 
 
Cheers.
 
Kumar _________________ IBM Certified WebSphere MQ V5.3 Developer
 
IBM Certified WebSphere MQ V5.3 Solution Designer
 
IBM Certified WebSphere MQ V5.3 System Administrator | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | mrlinux | 
		  
		    
			  
				 Posted: Tue Jul 23, 2002 4:48 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Grand Master
 
 Joined: 14 Feb 2002 Posts: 1261 Location: Detroit,MI USA 
  | 
		  
		    
			  
				Send me the code I will look at it. _________________ Jeff 
 
 
IBM Certified Developer MQSeries
 
IBM Certified Specialist MQSeries
 
IBM Certified Solutions Expert MQSeries | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | ryno | 
		  
		    
			  
				 Posted: Tue Jul 23, 2002 10:12 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Novice
 
 Joined: 22 Jul 2002 Posts: 17
  
  | 
		  
		    
			  
				| Awesome, I sent a copy to you both to look at.  I really appreciate it, I think im really close but missing something dumb.  thank you | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | kolban | 
		  
		    
			  
				 Posted: Tue Jul 23, 2002 11:15 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Grand Master
 
 Joined: 22 May 2001 Posts: 1072 Location: Fort Worth, TX, USA 
  | 
		  
		    
			  
				| Maybe post the code here and others can look-see too? | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | ryno | 
		  
		    
			  
				 Posted: Tue Jul 23, 2002 11:47 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Novice
 
 Joined: 22 Jul 2002 Posts: 17
  
  | 
		  
		    
			  
				you bet, thanks alot
   
	| Code: | 
   
  
	
 
#define  T2REMOTE_QNAME "Q2AIX"    /* name of remote Q   */
 
#define  MAX_MSG_LENGTH 4194304    /* max length of Q messages*/
 
#define  COMMAND_QUEUE "SYSTEM.ADMIN.COMMAND.QUEUE" /* CMD Q */
 
#define  RESPONSE_QUEUE "SYSTEM.ADMIN.RESPQ.QDEL"
 
#define MESSAGE_EXPIRY_TIME 1800
 
#define WAIT_INTERVAL 180000  /* Wait interval for MQGET  */
 
 
#include <stdio.h>
 
#include <stdlib.h>
 
#include <string.h>
 
#include <nt.h>
 
#include <cl2dqapi.h>
 
#include <cl2utils.h>
 
#include <clsdqapi.h>
 
#include <distinfo.h>
 
#include <distxmit.h>
 
#include <clsutils.h>
 
#include <clsapi.h>
 
#include <tranreq.h>
 
#include <debug.h>
 
#include <time.h>
 
#include <logt2.h>
 
#include <cmqc.h>                         /* includes for MQI */
 
#include <cmqcfc.h>
 
#include <cmqxc.h>
 
 
 
/*   Declare MQI structures needed                                          */
 
static MQHOBJ hCommandQ;                  /* command queue handle */
 
static MQHOBJ hResponseQ;                 /* response queue handle */
 
static MQOD       od = {MQOD_DEFAULT};    /* Object Descriptor              */
 
static MQHCONN hConn = (MQHCONN)NULL;     /* connection handle              */
 
static MQHOBJ  Hobj3 = MQHO_UNUSABLE_HOBJ;/* object handle for T3 Q (write) */
 
static MQMD    MsgDesc = {MQMD_DEFAULT};  /* Message descriptor             */
 
static MQPMO   PutMsgOpts ={MQPMO_DEFAULT};/* put-message options           */
 
static MQLONG  iBuflen;                   /* buffer length                  */
 
static MQLONG  O_options;                 /* MQOPEN options                 */
 
static MQLONG  iCompCode;                 /* completion code                */
 
static MQLONG  iReason;                   /* reason code                    */
 
static MQLONG  C_options;                 /* MQCLOSE options                */
 
MQBYTE buffer[MAX_MSG_LENGTH];            /* message buffer (length TBD)    */
 
CHAR   QMName[MQ_Q_MGR_NAME_LENGTH];      /* queue manager name             */
 
CHAR   pchProgram[8];                     /* name of this program           */
 
PCH    pchMsg;
 
CHAR   message_buffer[] = "USERID: GATESB ";
 
 
/****   Internal Function Prototypes   ***/
 
static MQLONG Initialize(void);
 
static VOID Shutdown(void);
 
static BOOL MQIsDown(MQLONG);
 
static MQLONG PutMessage(void);
 
void InquireQMgrName(MQHCONN hConn, MQHOBJ hCommandQ,
 
      MQCHAR48 CommandQ, MQCHAR48 ReplyToQ);
 
 
void ProcessQMgrName(MQHCONN hConn, MQHOBJ hResponseQ,
 
      MQCHAR48 ResponseQ, char* QMgrName);
 
 
void GetMsg(MQHCONN hConn, MQHOBJ hQName, MQCHAR48 QName,
 
      MQBYTE *MsgBuffer, MQLONG BufferLen);
 
 
void PutMsg(MQHCONN hConn, MQCHAR8 MsgFormat, MQHOBJ hQName,
 
            MQCHAR48 QName, MQCHAR48 ReplyToQ, MQBYTE *UserMsg,
 
            MQLONG UserMsgLen);
 
 
MQHOBJ OpenQ(MQHCONN hConn, MQCHAR48 QMgrName,
 
    MQCHAR48 QName, MQLONG OpenOpts);
 
 
void main()
 
{
 
 
LONG      iRet = 0;
 
 
strcpy(LOG_FILENAME, "*curlib/");
 
strcat(LOG_FILENAME, "QLOG");
 
 
   LogMsg(LOG_DEBUG, "MQ DELETION PROGRAM RUNNING TEST");
 
/*iRet = Initialize(); */
 
 
/* if (iRet != MQCC_OK)  */
 
/* {             */
 
/* CloseLogs();  */
 
/* exit(iReason);  */
 
/* } */
 
   /*        PCF cmd sequence    */
 
   /*   Inquire Queue (MQCMD_INQUIRE_Q)*/
 
   /*   Clear Queue (MQCMD_CLEAR_Q) */
 
   /*   Delete Queue (MQCMD_DELETE_Q) */
 
 
  memset(QMName, '\0', MQ_Q_MGR_NAME_LENGTH);
 
  /* Open CMD Q, handle defined here for usage */
 
    hCommandQ = OpenQ(hConn,
 
                QMName,
 
                COMMAND_QUEUE,
 
                MQOO_OUTPUT + MQOO_FAIL_IF_QUIESCING);
 
 
  /* Open REPLY Q,  handle defined here for usage */
 
    hResponseQ = OpenQ(hConn,
 
                 QMName,
 
                 RESPONSE_QUEUE,
 
                 MQOO_INPUT_SHARED + MQOO_FAIL_IF_QUIESCING);
 
 
 /*memset(QMName, '\0', MQ_Q_MGR_NAME_LENGTH);*/
 
 
 InquireQMgrName(hConn, hCommandQ, COMMAND_QUEUE, RESPONSE_QUEUE);
 
 
 ProcessQMgrName(hConn, hResponseQ, RESPONSE_QUEUE, QMName);
 
 
/*PutMessage();*/
 
Shutdown();
 
CloseLogs();
 
exit(0);
 
} /* end MQPRO */
 
 
/********************************************************************
 
/* Function   : Initialize*/
 
 
MQLONG Initialize(void)
 
{
 
 
        QMName[0] = 0;
 
 
        MQCONN( QMName,                      /* queue manager     */
 
                    &hConn,                  /* connection handle */
 
                    &iCompCode,              /* completion code   */
 
                    &iReason );              /* reason code       */
 
 
 /* LogMsg( LOG_DEBUG, "local qmgr = %s ", QMName); */
 
 
 
        LogMsg( LOG_DEBUG, "MQCONN: CompCode = %ld, Reason Code = %ld.",
 
                   iCompCode, iReason);
 
 
        if (MQIsDown(iReason))
 
           exit(iReason);
 
 
        if( iCompCode != MQCC_OK )
 
        {
 
                LogMsg(LOG_MINIMAL, "%s: cannot connect to local queue manager",
 
                        pchProgram);
 
                return iReason;
 
        }
 
 
/* Set OpenOptions to MQOO_OUTPUT + MQOO_FAIL_IF_QUIESCING         */
 
/* Open remote queue Q2AIX for output -               */
 
 
        strcpy(od.ObjectName, T2REMOTE_QNAME);
 
        memset(od.ObjectQMgrName, ' ', 10);
 
 
        O_options = MQOO_OUTPUT + MQOO_FAIL_IF_QUIESCING;
 
    MQOPEN( hConn,                    /* connection handle    */
 
            &od,                      /* Q object descriptor  */
 
            O_options,                /* open options         */
 
            &Hobj3,                   /* object handle        */
 
            &iCompCode,               /* completion code      */
 
            &iReason );               /* reason code          */
 
    LogMsg( LOG_DEBUG,
 
            "MQOPEN Q2AIX queue: CompCode = %ld, Reason Code = %ld.",
 
            iCompCode, iReason);
 
 
    if (MQIsDown(iReason))
 
       exit(iReason);
 
 
        if( iCompCode != MQCC_OK )
 
        {
 
                LogMsg(LOG_MINIMAL, "%s: cannot connect to queue %s",
 
                        pchProgram, od.ObjectName);
 
        /*C_options = 0;        no close options        */
 
                MQDISC( &hConn, &iCompCode, &iReason );
 
                if (MQIsDown(iReason))
 
                   exit(iReason);
 
                return -2;
 
        }
 
 
        return MQCC_OK;
 
}
 
 
/********************************************************************
 
/* Function   : Shutdown
 
/* Description: closes queues and disconnects from queue manager
 
/* Returns    : nothing
 
/* Notes      :
 
/********************************************************************/
 
VOID Shutdown(void)
 
{
 
/* Close remote queue Q2AIX */
 
/* If (CompCode is not MQCC_OK) then                               */
 
/*      Log MQ Error                                               */
 
/* Endif                                                           */
 
 
        MQCLOSE(hConn,                 /* connection handle           */
 
                         &Hobj3,       /* object handle               */
 
                         MQCO_NONE,    /* no close options            */
 
                         &iCompCode,   /* completion code             */
 
                         &iReason );   /* reason code                 */
 
 
    LogMsg( LOG_DEBUG,
 
            "MQCLOSE Q2AIX queue: CompCode = %ld, Reason Code = %ld.",
 
            iCompCode, iReason);
 
 
    if (MQIsDown(iReason))
 
       exit(iReason);
 
        if( iCompCode != MQCC_OK )
 
        {
 
        LogMsg(LOG_MINIMAL,
 
               "%s: cannot close queue %s", pchProgram,
 
               T2REMOTE_QNAME);
 
        }
 
 
/* Disconnect from local queue manager - AS/400                   */
 
/* If (CompCode is not MQCC_OK) then                              */
 
/*      Log MQ Error                                              */
 
/*      Exit(ReasonCode)                                          */
 
/* Endif                                                          */
 
 
        MQDISC(&hConn,             /* connection handle           */
 
            &iCompCode,            /* completion code             */
 
            &iReason );            /* reason code                 */
 
 
        LogMsg( LOG_DEBUG, "MQDISC: CompCode = %ld, Reason Code = %ld.",
 
                   iCompCode, iReason);
 
 
        if (MQIsDown(iReason))
 
           exit(iReason);
 
 
        if( iCompCode != MQCC_OK )
 
        {
 
                LogMsg(LOG_MINIMAL,
 
               "%s: cannot disconnect from local queue manager",
 
               pchProgram);
 
        }
 
}
 
 
/*******************************************************************
 
/* Function   : PutMessage
 
/* Description: Writes a message to the remoteQ    Q2AIX
 
/* Returns    : MQLONG -- the return from the API call to MQPUT
 
/* Notes      :
 
/******************************************************************/
 
MQLONG PutMessage()
 
{
 
                               /*PMO Structure*/
 
     memset(&PutMsgOpts, '\0', sizeof(MsgDesc));
 
     memcpy(PutMsgOpts.StrucId, MQPMO_STRUC_ID,
 
           sizeof(PutMsgOpts.StrucId));
 
 
     PutMsgOpts.Version = MQPMO_VERSION_1;
 
 
                              /*MD Structure*/
 
     memset(&MsgDesc, '\0', sizeof(MsgDesc));
 
     memcpy(MsgDesc.StrucId, MQMD_STRUC_ID,
 
           sizeof(MsgDesc.StrucId));
 
 
     MsgDesc.Version     = MQMD_VERSION_1;
 
     MsgDesc.Expiry      = MQEI_UNLIMITED;
 
     MsgDesc.Report      = MQRO_NONE;
 
     MsgDesc.MsgType     = MQMT_DATAGRAM;
 
     MsgDesc.Priority    = 1;
 
     MsgDesc.Persistence = MQPER_PERSISTENT;
 
     memcpy(MsgDesc.Format, MQFMT_ADMIN, sizeof(MsgDesc.Format));
 
     memset(MsgDesc.ReplyToQ, '\0', sizeof(MsgDesc.ReplyToQ));
 
 
 
        MQPUT( hConn,                  /* connection handle         */
 
               Hobj3,                 /* object handle             */
 
               &MsgDesc,              /* message descriptor        */
 
               &PutMsgOpts,           /* default options (datagram)*/
 
               sizeof(message_buffer),
 
               message_buffer,
 
               &iCompCode,            /* completion code           */
 
               &iReason );            /* reason code               */
 
 
        LogMsg( LOG_DEBUG,
 
   "MQPUT Q2AIX queue: CompCode = %ld, Reason Code = %ld.",
 
                iCompCode, iReason);
 
 
        if (MQIsDown(iReason))
 
           exit(iReason);
 
 
        if (iCompCode != MQCC_OK)
 
        {
 
        LogMsg(LOG_MINIMAL,
 
               "MQPUT failed with reason code %d.", iReason);
 
        }
 
        return iReason;
 
} /*end of PutMessage*/
 
 
BOOL MQIsDown(MQLONG reasoncode)
 
{
 
BOOL result;
 
 
result = FALSE;
 
if ((reasoncode == MQRC_Q_MGR_NOT_AVAILABLE) ||
 
    (reasoncode == MQRC_CONNECTION_BROKEN)   ||
 
    (reasoncode == MQRC_Q_MGR_STOPPING)      ||
 
    (reasoncode == MQRC_Q_MGR_QUIESCING))
 
   result = TRUE;
 
 
return(result);
 
}
 
 
 
 
 
 
 
 void InquireQMgrName(MQHCONN hConn,  /* Connection to queue mgr */
 
       MQHOBJ hCommandQ, /* handle to command queue */
 
       MQCHAR48 CommandQ, /* Command queue     */
 
       MQCHAR48 ReplyToQ) /* Reply queue      */
 
 
 {
 
  MQLONG  AdminMsgLen;       /* Length of user message buffer   */
 
  MQBYTE  *pAdminMsg;        /* Ptr to outbound data buffer     */
 
  MQCFH   *pPCFHeader;       /* Ptr to PCF header structure     */
 
  MQCFIL  *pPCFIntegerList;  /* Ptr to PCF integer list block   */
 
 
  /* Set the length for the message buffer */
 
 
     AdminMsgLen = MQCFH_STRUC_LENGTH
 
                 + MQCFIL_STRUC_LENGTH_FIXED + sizeof(MQLONG);
 
 
  /* Allocate storage for the msg buffer set a ptr to start address*/
 
 
   pAdminMsg   = (MQBYTE *)malloc( AdminMsgLen );
 
   memset(pAdminMsg, '\0', AdminMsgLen);
 
 
   pPCFHeader  = (MQCFH *)pAdminMsg;
 
   pPCFIntegerList = (MQCFIL *)(pAdminMsg + MQCFH_STRUC_LENGTH);
 
 
   /* Setup request header */
 
    pPCFHeader->Type           = MQCFT_COMMAND;
 
    pPCFHeader->StrucLength    = MQCFH_STRUC_LENGTH;
 
    pPCFHeader->Version        = MQCFH_VERSION_1;
 
    pPCFHeader->Command        = MQCMD_INQUIRE_Q_MGR;
 
    pPCFHeader->MsgSeqNumber   = MQCFC_LAST;
 
    pPCFHeader->Control        = MQCFC_LAST;
 
    pPCFHeader->ParameterCount = 1;
 
 
    /* Setup the queue manager attribute - name */
 
     pPCFIntegerList->Type   = MQCFT_INTEGER_LIST;
 
     pPCFIntegerList->StrucLength = MQCFIL_STRUC_LENGTH_FIXED
 
               + sizeof(MQLONG);
 
     pPCFIntegerList->Parameter  = MQIACF_Q_MGR_ATTRS;
 
     pPCFIntegerList->Count   = 1;
 
     pPCFIntegerList->Values[0]  = MQCA_Q_MGR_NAME;
 
 
     PutMsg(hConn,
 
          MQFMT_ADMIN,
 
                hCommandQ,
 
                CommandQ,
 
                ReplyToQ,
 
                (MQBYTE *)pAdminMsg,
 
                AdminMsgLen);
 
 
      /* Free the storage allocated to the message buffer */
 
 
       free(pAdminMsg);
 
      }
 
 
 void ProcessQMgrName(MQHCONN hConn,   /* Connection to queue mgr */
 
       MQHOBJ hResponseQ,  /* Handle to reply Q    */
 
       MQCHAR48 ResponseQ, /* Command reply Q     */
 
       char* QMgrName)  /* Queue manager name      */
 
 
 {
 
  MQLONG  ResponseMsgLen;    /* Length of user message buffer   */
 
  MQBYTE  *pResponseMsg;     /* Ptr to outbound data buffer     */
 
  MQCFH  *pPCFHeader;       /* Ptr to PCF header structure     */
 
  MQCFST  *pPCFString;    /* Ptr to PCF string block    */
 
  char  QueueManagerName[MQ_Q_MGR_NAME_LENGTH];
 
 
  ResponseMsgLen = MQCFH_STRUC_LENGTH
 
           + MQCFST_STRUC_LENGTH_FIXED +
 
        + MQ_Q_MGR_NAME_LENGTH;
 
 
  pResponseMsg   = (MQBYTE *)malloc( ResponseMsgLen );
 
   memset( pResponseMsg, ' ', ResponseMsgLen );
 
 
  GetMsg(hConn, hResponseQ, RESPONSE_QUEUE, pResponseMsg,
 
       ResponseMsgLen);
 
 
  pPCFHeader  = (MQCFH *)pResponseMsg;
 
 
  pPCFString  = (MQCFST *)(pResponseMsg + MQCFH_STRUC_LENGTH);
 
 
 
  /* all the error handling/logging here */
 
 
 
 
  free(pResponseMsg);
 
}
 
 
 /*****************************************************************/
 
 /* OpenQ                                                         */
 
 /*                                                               */
 
 /*     Open the MQ queue "QName" on queue manager "QMgrName".    */
 
 /*****************************************************************/
 
 MQHOBJ OpenQ(MQHCONN hConn,   /* Connection to queue manager */
 
     MQCHAR48 QMgrName,  /* Queue manager name   */
 
     MQCHAR48 QName,  /* Queue name     */
 
     MQLONG OpenOpts)  /* Open options     */
 
 {
 
  MQHOBJ hOpenQ;
 
  MQOD ObjDesc = {MQOD_DEFAULT};
 
  MQLONG CompCode;
 
  MQLONG Reason;
 
 
  strncpy(ObjDesc.ObjectName, QName, MQ_Q_NAME_LENGTH);
 
   strncpy(ObjDesc.ObjectQMgrName, QMgrName, MQ_Q_MGR_NAME_LENGTH);
 
 
   MQOPEN(hConn,             /* I  : Queue manager handle   */
 
             &ObjDesc,                  /* IO : queue attributes*/
 
             OpenOpts,                  /* I  :                */
 
             &hOpenQ,                   /*  O : handle to open queue*/
 
             &CompCode,                 /*  O : OK/Warning/Error */
 
             &Reason        /*  O : Reason for above       */
 
           );
 
  if (CompCode != MQCC_OK)
 
   {
 
    LogMsg(LOG_DEBUG,"open for cmd srv failed");
 
   exit(CompCode);
 
   }
 
              return(hOpenQ);
 
                         /*go back and add more logging*/
 
 }
 
 
 
 /***************************************************************/
 
 /* PutMsg                                                      */
 
 /*                                                             */
 
 /*     Put a MQ message on the queue "QName".                  */
 
 /***************************************************************/
 
 void PutMsg(MQHCONN   hConn,  /* Connection to queue manager*/
 
             MQCHAR8   MsgFormat, /* Format of user data to be */
 
             MQHOBJ    hQName,  /* handle of queue to put the */
 
             MQCHAR48  QName,  /* name of queue to put the mes*/
 
             MQCHAR48  ReplyToQ,  /* name of q on which to rec*/
 
             MQBYTE   *UserMsg,  /* data to be put in msg */
 
             MQLONG    UserMsgLen) /* Length of user data     */
 
 
 {
 
  MQMD    MsgDesc = {MQMD_DEFAULT};      /* Message description*/
 
  MQPMO   PutMsgOpts = {MQPMO_DEFAULT};  /* Controls  MQPUT*/
 
  MQLONG  CompCode;                      /* Completion code*/
 
  MQLONG  Reason;                        /* reason qualifying CompCode*/
 
 
  MsgDesc.Persistence    = MQPER_NOT_PERSISTENT;
 
   memset( MsgDesc.ReplyToQMgr, ' ', MQ_Q_MGR_NAME_LENGTH );
 
   MsgDesc.MsgType  = MQMT_REQUEST;
 
 
   MsgDesc.Report   = MQRO_PASS_CORREL_ID;
 
   memcpy(MsgDesc.MsgId, MQMI_NONE, sizeof(MsgDesc.MsgId));
 
   strcpy(MsgDesc.CorrelId, "QueueDel");
 
 
  memcpy( MsgDesc.ReplyToQ, RESPONSE_QUEUE, strlen(RESPONSE_QUEUE)+1);
 
   memcpy( MsgDesc.Format,MQFMT_ADMIN, sizeof(MsgDesc.Format));
 
 
    MsgDesc.Expiry = MESSAGE_EXPIRY_TIME;
 
 
    PutMsgOpts.Options  = MQPMO_FAIL_IF_QUIESCING;
 
 
  MQPUT(hConn,                     /* I  : Queue manager handle  */
 
            hQName,                    /* I  : Queue handle */
 
            &MsgDesc,                  /* IO : Message attributes*/
 
            &PutMsgOpts,               /* IO : Control  MQPUT */
 
            UserMsgLen,                /* I  : User message length*/
 
            UserMsg,                   /* I  : User message  */
 
            &CompCode,                 /*  O : OK/Warning/Error */
 
            &Reason);                  /*  O : Reason for above*/
 
 if ( CompCode == MQCC_OK )
 
  {
 
  LogMsg(LOG_DEBUG,"PCF command was put on the cmd server");
 
   return;
 
  }
 
  else
 
  {
 
   LogMsg(LOG_DEBUG,"Error in routine PutMsg()\n");
 
   LogMsg(LOG_DEBUG,"pcf MQPUT failed for queue %s. CC=%d RC=%d\n",
 
                QName,
 
       CompCode,
 
                Reason);
 
 
    exit(-1);
 
   }
 
  }
 
 
 /**************************************************************/
 
 /* GetMsg                                                     */
 
 /*                                                            */
 
 /*     Get a MQ message from the queue "QName".               */
 
 /**************************************************************/
 
 void GetMsg(MQHCONN   hConn,   /* handle of queue manager     */
 
             MQHOBJ    hQName,   /* handle of queue to read from*/
 
             MQCHAR48  QName,   /* name of queue to read from  */
 
       MQBYTE   *MsgBuffer,  /* Input/Output buffer containing msg */
 
             MQLONG    BufferLen)  /* Length of supplied buffer */
 
 {
 
 
     MQMD    MsgDesc = {MQMD_DEFAULT};       /* Message description*/
 
     MQGMO   GetMsgOpts = {MQGMO_DEFAULT};   /* Options to  MQGET*/
 
     MQLONG  MsgBufferLen;                   /* Actual length rec */
 
     MQLONG  CompCode;                       /* Completion code */
 
     MQLONG  Reason;                         /* reason qualif CompC*/
 
 
  GetMsgOpts.Options  = MQGMO_WAIT + MQGMO_FAIL_IF_QUIESCING;
 
   GetMsgOpts.WaitInterval  = WAIT_INTERVAL;
 
 
   memcpy(MsgDesc.MsgId, MQMI_NONE, sizeof(MsgDesc.MsgId));
 
   strcpy(MsgDesc.CorrelId, "QueueDel");
 
 
 
  MQGET(hConn,   /* I  : Queue manager handle              */
 
        hQName,   /* I  : handle to QName to read from      */
 
        &MsgDesc,         /* IO : message attributes          */
 
            &GetMsgOpts,      /* IO : control action of MQGET */
 
            BufferLen,     /* I  : length of supplied buffer  */
 
            MsgBuffer,        /*  O : User data to be put    */
 
            &MsgBufferLen,    /*  O : Actual length of returned message*/
 
            &CompCode,        /*  O : OK/Warning/Error    */
 
            &Reason);         /*  O : Reason for above    */
 
 
   if( CompCode == MQCC_OK )
 
   {
 
   LogMsg(LOG_DEBUG,"PCF command was recd from cmd server");
 
    return;
 
   }
 
   else
 
   {
 
    LogMsg(LOG_DEBUG,"Error in routine GetMsg()\n");
 
    LogMsg(LOG_DEBUG,"pcf MQGET failed for queue %s. CC=%d RC=%d\n",
 
                 QName,
 
        CompCode,
 
                 Reason);
 
 
     exit(-1);
 
    }
 
  }
 
 
 
 | 
   
 
 | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | mrlinux | 
		  
		    
			  
				 Posted: Thu Jul 25, 2002 7:29 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Grand Master
 
 Joined: 14 Feb 2002 Posts: 1261 Location: Detroit,MI USA 
  | 
		  
		    
			  
				Did you try the suggestions from above ??? _________________ Jeff 
 
 
IBM Certified Developer MQSeries
 
IBM Certified Specialist MQSeries
 
IBM Certified Solutions Expert MQSeries | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | mrlinux | 
		  
		    
			  
				 Posted: Thu Jul 25, 2002 8:30 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Grand Master
 
 Joined: 14 Feb 2002 Posts: 1261 Location: Detroit,MI USA 
  | 
		  
		    
			  
				I have compiled the code and it does get the qmgr name in the reply message.   I had to uncomment this section 
 
/*iRet = Initialize(); */  I dont know if that is your issue. _________________ Jeff 
 
 
IBM Certified Developer MQSeries
 
IBM Certified Specialist MQSeries
 
IBM Certified Solutions Expert MQSeries | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | ryno | 
		  
		    
			  
				 Posted: Fri Jul 26, 2002 3:56 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Novice
 
 Joined: 22 Jul 2002 Posts: 17
  
  | 
		  
		    
			  
				You found the name in the what queue????
 
 
thanks | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | 
		    
		   | 
		 
	   
	 | 
   
 
  
	     | 
	Goto page 1, 2  Next | 
	Page 1 of 2 | 
   
 
 
 
  
  	
	  
		
		  
 
  | 
		  You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
  | 
  		 
	   
	 | 
   
 
  	 | 
	  |