ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Facing MQ Return Code 3003 Error (MQRCCF_CFH_VERSION_ERROR)

Post new topic  Reply to topic
 Facing MQ Return Code 3003 Error (MQRCCF_CFH_VERSION_ERROR) « View previous topic :: View next topic » 
Author Message
vignesh1988
PostPosted: Sun Mar 09, 2014 6:14 am    Post subject: Facing MQ Return Code 3003 Error (MQRCCF_CFH_VERSION_ERROR) Reply with quote

Acolyte

Joined: 13 Apr 2013
Posts: 62
Location: Chennai

Hi Everybody,

I am trying to connect to Z/OS Queue manager through my Client Code (MQCONNX) , and trying to define a Queue using MQAI/PCF command formats.
My mqExecute call is issuing MQRC 3003 Error ( MQRCCF_CFH_VERSION_ERROR) , WMQ return code says the Version must be MQCFH_VERSION_3 , and the command format must be MQCFT_COMMAND_XR and as IBM said, i did add these 2 formats in the code but no luck Still my code failing with 3003. I was totally sitting with this code for past 2 days to correct this error.

Also IBM says to added the Format as MQFMT_ADMIN , but i really dont know where to add.
Also i was reading System/User selectors and modified the code

Please help me out Here is my Code:

Code:

#include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
 #include <string.h>

 /* includes for WebSphere MQ */
 #include <cmqc.h>                  /* For regular MQI definitions   */
 #include <cmqxc.h>                 /* For MQCD definition           */

#include <cmqcfc.h>                        /* PCF                             */
#include <cmqbc.h>                         /* MQAI                            */

 #define OK 0
 #define FAIL 1


 /* function prototypes of local functions */

void CreateMQObject(MQHCONN, MQCHAR *);
void CheckCallResult(MQCHAR *, MQLONG , MQLONG );

 int main(int argc, char **argv)
 {

   /*   Declare MQI structures needed                                */
   MQCNO    Connect_options = {MQCNO_DEFAULT};
                                    /* MQCONNX options               */
   MQCD     ClientConn = {MQCD_CLIENT_CONN_DEFAULT};
                                    /* Client connection channel     */
                                    /* definition                    */
      /** note, sample uses defaults where it can **/

   MQCHAR   QMName[MQ_Q_MGR_NAME_LENGTH];
   MQCHAR   QName[MQ_Q_NAME_LENGTH+1];
   MQCHAR   Channel_Name[MQ_CHANNEL_NAME_LENGTH+1];
   MQCHAR   Connection_Name[MQ_CONN_NAME_LENGTH+1];
                                    /* name of connection q manager  */
   MQHCONN  Hcon;                   /* connection handle             */
   MQLONG   CompCode;               /* completion code               */
   MQLONG   Reason;                 /* reason code                   */
   MQLONG   CReason;                /* reason code for MQCONNX       */

   printf("Sample AMQSCNXC start\n");
   printf("Argument : %d\n",argc);
   if ( argc == 5)
   {
    strcpy(Connection_Name,argv[1]);
    strcpy(Channel_Name,argv[2]);
    strcpy(QMName,argv[3]);
    strcpy(QName,argv[4]);
    printf("%s : %s : %s : %s\n",Connection_Name,Channel_Name,QMName,QName);
   }
   else
   {
     printf("Usage:\n");
     printf("\t%s ConnName SvrconnChannelName QMgrName QName\n",
            argv[0]);
     exit(99);
   }

    printf("Connecting to queue manager %-48.48s\n", QMName);
   printf("Going to create a New Queue named %-48.48s\n",QName);

     strncpy(ClientConn.ConnectionName,
             Connection_Name,
             MQ_CONN_NAME_LENGTH);

     strncpy(ClientConn.ChannelName,
             Channel_Name,
             MQ_CHANNEL_NAME_LENGTH);
     Connect_options.ClientConnPtr = &ClientConn;
    Connect_options.Version = MQCNO_VERSION_2;

     printf("using the server connection channel %s\n",
            Channel_Name);
     printf("on connection name %s.\n", Connection_Name);

   MQCONNX(QMName,                 /* queue manager                  */
           &Connect_options,       /* options for connection         */
           &Hcon,                  /* connection handle              */
           &CompCode,              /* completion code                */
           &CReason);              /* reason code                    */

   /* report reason and stop if it failed     */
   if (CompCode == MQCC_FAILED)
   {
     printf("MQCONNX ended with reason code %d\n", CReason);
     exit( (int)CReason );
   }
   printf("Connection Return Code : %d\n",CReason);
   CreateMQObject(Hcon, QName);
   
  if (CReason != MQRC_ALREADY_CONNECTED)
   {
     MQDISC(&Hcon,                   
            &CompCode,               
            &Reason);                 

     
     if (Reason != MQRC_NONE)
     {
       printf("MQDISC ended with reason code %d\n", Reason);
     }
   }

   return(0);
 }


 void CreateMQObject(MQHCONN hConn, MQCHAR *qName)
{
   MQOD     od = {MQOD_DEFAULT};    /* Object Descriptor             */
   MQCFH    *pPCFHeader;
   MQLONG reason;                          /* reason code                     */
   MQLONG compCode;                        /* completion code                 */
   MQHBAG commandBag = MQHB_UNUSABLE_HBAG; /* command bag for mqExecute       */
   MQHBAG responseBag = MQHB_UNUSABLE_HBAG;/* response bag for mqExecute      */
   MQHBAG resultBag;                       /* result bag from mqExecute       */
   MQHBAG OptionsBag = MQHB_UNUSABLE_HBAG;
   MQLONG mqExecuteCC;                     /* mqExecute completion code       */
   MQLONG mqExecuteRC;                     /* mqExecute reason code           */

   MQHOBJ AdminQ;
   MQLONG O_options;                       /* MQOPEN options                */
   MQLONG C_options;
   MQCFH chl;
   strncpy(od.ObjectName, "SYSTEM.COMMAND.INPUT", (size_t)MQ_Q_NAME_LENGTH);
   printf("Command Server Queue is %s\n", od.ObjectName);

   printf("\nCreating Local Queue %s\n\n", qName);
    O_options = MQOO_OUTPUT            /* open queue for output     */
               | MQOO_FAIL_IF_QUIESCING /* but not if MQM stopping   */
               ;                        /* = 0x2010 = 8208 decimal   */
   
   MQOPEN(hConn,                      /* connection handle            */
          &od,                       /* object descriptor for queue  */
          O_options,                 /* open options                 */
          &AdminQ,                     /* object handle                */
          &compCode,                 /* MQOPEN completion code       */
          &reason);                  /* reason code                  */

   /* report reason, if any; stop if failed      */
   if (reason != MQRC_NONE)
   {
     printf("MQOPEN ended with reason code %d\n", reason);
   }

   if (compCode == MQCC_FAILED)
   {
     printf("unable to open queue %s for output\n",od.ObjectName);
    exit(99);
   }
   printf("MQ OPEN for %s : %d\n",od.ObjectName,reason);
   
   mqCreateBag(MQCBO_ADMIN_BAG, &commandBag, &compCode, &reason);
   CheckCallResult("Create the command bag", compCode, reason);
   if (compCode !=MQCC_OK)
      return;

   mqCreateBag(MQCBO_ADMIN_BAG, &responseBag, &compCode, &reason);
   CheckCallResult("Create the response bag", compCode, reason);
   if (compCode !=MQCC_OK)
      return;
 

   mqCreateBag(MQCBO_COMMAND_BAG, &OptionsBag,&compCode, &reason);
      CheckCallResult("Create options bag", compCode, reason);
     printf("Create options bag: %d\n",reason);
     if (compCode == MQCC_OK && reason == MQRC_NONE)
      {

         mqSetInteger(OptionsBag, MQIASY_TYPE , MQIND_NONE, MQCFT_COMMAND_XR, &compCode, &reason);
       CheckCallResult("Options type is added", compCode, reason);
       printf("Option type is added: %d\n",reason);
      mqSetInteger(OptionsBag, MQIASY_VERSION, MQIND_NONE , MQCFH_VERSION_3, &compCode, &reason);
       CheckCallResult("Options version is added", compCode, reason);
       printf("Option version    is added: %d\n",reason);
      }


   mqAddString(commandBag, MQCA_Q_NAME, MQBL_NULL_TERMINATED, qName, &compCode,
               &reason);
   CheckCallResult("Add q name to command bag", compCode, reason);
 
   
   mqAddInteger(commandBag, MQIA_Q_TYPE, MQQT_LOCAL, &compCode, &reason);
   CheckCallResult("Add q type to command bag", compCode, reason);
   
   /***** IF MQIA_Q_TYPE == MQQT_LOCAL *****/
      mqAddInteger(commandBag, MQIA_MAX_MSG_LENGTH, 1200, &compCode, &reason);
      CheckCallResult("Add Attribue", compCode, reason);
      mqAddString(commandBag, MQCA_INITIATION_Q_NAME, MQBL_NULL_TERMINATED, "UNIX.INQ", &compCode, &reason);
      CheckCallResult("Add Attribute", compCode, reason);
   
   mqExecute(hConn,                 
             MQCMD_CREATE_Q,         
             OptionsBag,               
             commandBag,             
             responseBag,             
             AdminQ,                   
             MQHO_NONE,             
             &compCode,             
             &reason);               
 
   if (reason == MQRC_CMD_SERVER_NOT_AVAILABLE)
   {
      printf("Please start the command server: <strmqcsv QMgrName>\n");
      MQDISC(&hConn, &compCode, &reason);
      CheckCallResult("MQDISC", compCode, reason);
      exit(98);
   }

   if ( compCode == MQCC_OK )
      printf("Local queue %s successfully created\n", qName);
   else
   {
      printf(" mqExecute reason : %d\n",reason);
      if (reason == 2035)
        printf("FAILED:Via Queues,MQRC:2035");
      if (reason == MQRCCF_COMMAND_FAILED)
      {
         mqInquireBag(responseBag, MQHA_BAG_HANDLE, 0, &resultBag, &compCode,
                      &reason);
         CheckCallResult("Get the result bag handle", compCode, reason);

         mqInquireInteger(resultBag, MQIASY_COMP_CODE, MQIND_NONE, &mqExecuteCC,
                          &compCode, &reason);
         CheckCallResult("Get the completion code from the result bag",
                          compCode, reason);
         mqInquireInteger(resultBag, MQIASY_REASON, MQIND_NONE, &mqExecuteRC,
                          &compCode, &reason);
         CheckCallResult("Get the reason code from the result bag", compCode,
                          reason);
       if (mqExecuteRC == 4001)
        printf("%s already exists, Failed with Return Code: %d\n",qName,mqExecuteRC);
       else if (mqExecuteRC == 2085)
        printf("%s doesn't Exist for Alter/Delete, MQRC = %d\n",qName,mqExecuteRC);
       else
        printf("Creation of local queue %s failed: return Code = %d\n",qName,mqExecuteRC);
      }
   }

   if (commandBag != MQHB_UNUSABLE_HBAG)
   {
      mqDeleteBag(&commandBag, &compCode, &reason);
      CheckCallResult("Delete the command bag", compCode, reason);
   }
 
   if (responseBag != MQHB_UNUSABLE_HBAG)
   {
      mqDeleteBag(&responseBag, &compCode, &reason);
      CheckCallResult("Delete the response bag", compCode, reason);
   }
   
   if (compCode != MQCC_FAILED)
   {
     C_options = 0;
     MQCLOSE(hConn,                   /* connection handle            */
             &AdminQ,                  /* object handle                */
             C_options,
             &compCode,              /* completion code              */
             &reason);               /* reason code                  */

     /* report reason, if any     */
     if (reason != MQRC_NONE)
     {
       printf("MQCLOSE ended with reason code %d\n", reason);
     }
   }

} /* end of CreateMQObject */
 

void  CheckCallResult(char *callText, MQLONG cc, MQLONG rc)
{
   if (cc != MQCC_OK)
         printf("%s failed: Completion Code = %d : Reason = %d\n", callText, cc, rc);
 
}

Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Sun Mar 09, 2014 12:27 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

zOS is a little bit particular and this might also reflect on pcf commands for zOS.... Wouldn't it be easier to use support pack MO72?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Sun Mar 09, 2014 12:31 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

fjb_saper wrote:
zOS is a little bit particular and this might also reflect on pcf commands for zOS.... Wouldn't it be easier to use support pack MO72?


It's a lot easier to use the Java PCF classes than the MQ Admin API stuff.

And it's twice as easy to use MS0S as it is to use MO72.

But this clearly seems like a bug in the AdminBag stuff that's creating the message. It should be setting the MQMD.Format automatically.

Thirdly, vignesh1988, I'm sure your zOS MQ admins would not be happy about you creating queues without going through them.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Mar 09, 2014 12:45 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

mqjeff wrote:

And it's twice as easy to use MS0S as it is to use MO72.

O.K. you're going to have to show me some time how to casually run a headless eclipse session... If I had been thinking GUI there would have been no need even for MSOS. The MQExplorer should have been enough...

But as you said, better get those zOS admins on board and have them define the queue... CSQUTIL comes to mind...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
vignesh1988
PostPosted: Sun Mar 09, 2014 5:46 pm    Post subject: Reply with quote

Acolyte

Joined: 13 Apr 2013
Posts: 62
Location: Chennai

I am the MQ Admin over here and i am trying to automate certain thigs we do manually here..

Note: This same code works fine in Distributed Systems (Non Mainframe pltforms)

I went through the below IBM Link but no luck..
[url] http://www-01.ibm.com/support/docview.wss?rs=171&uid=swg21244981 [/url]

So MQAdmins will only use this application..

Thanks..
Vignesh
Back to top
View user's profile Send private message Send e-mail
bruce2359
PostPosted: Sun Mar 09, 2014 6:39 pm    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

vignesh1988 wrote:
Note: This same code works fine in Distributed Systems (Non Mainframe platforms)

Yes, and the url below indicates that your app must be coded to be sensitive to both WMQ for z/OS and WMQ non-z/OS.

vignesh1988 wrote:
I went through the below IBM Link but no luck..
[url] http://www-01.ibm.com/support/docview.wss?rs=171&uid=swg21244981 [/url]

What does "I went through..." mean?

Do you mean that you read the narrative in the url? Did you re-coded your application as the url suggests so that it deals with both WMQ for z/OS and non-z/OS PCFs?
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
vignesh1988
PostPosted: Sun Mar 09, 2014 7:00 pm    Post subject: Reply with quote

Acolyte

Joined: 13 Apr 2013
Posts: 62
Location: Chennai

Yes, As of the URL says to change some stuffs. I changed as per them.
The part of my code is below.
But i don't know how to change Format as MQFMT_ADMIN.
Currently am just trying for Z/OS. After that works, I will integrate the functionality..

Code:

 mqCreateBag(MQCBO_COMMAND_BAG, &OptionsBag,&compCode, &reason);
      CheckCallResult("Create options bag", compCode, reason);
     printf("Create options bag: %d\n",reason);
     if (compCode == MQCC_OK && reason == MQRC_NONE)
      {

         mqSetInteger(OptionsBag, MQIASY_TYPE , MQIND_NONE, MQCFT_COMMAND_XR, &compCode, &reason);
       CheckCallResult("Options type is added", compCode, reason);
       printf("Option type is added: %d\n",reason);
      mqSetInteger(OptionsBag, MQIASY_VERSION, MQIND_NONE , MQCFH_VERSION_3, &compCode, &reason);
       CheckCallResult("Options version is added", compCode, reason);
       printf("Option version    is added: %d\n",reason);
      }


The above return codes are giving me 0, And my mqExecute looks like the below

Code:

mqExecute(hConn,                   /* WebSphere MQ connection handle           */
             MQCMD_CREATE_Q,          /* Command to be executed               */
             optionsBag,               /*  options bag                       */
             commandBag,              /* Handle to bag containing commands    */
             responseBag,             /* Handle to bag to receive the response*/
             AdminQ,               /* Put msg on SYSTEM.COMMAND.INPUT for Z/OS*/
             MQHO_NONE,               /* Create a dynamic q for the response  */
             &compCode,               /* Completion code from the mqExecute   */
             &reason);                /* Reason code from mqExecute call      */
Back to top
View user's profile Send private message Send e-mail
bruce2359
PostPosted: Sun Mar 09, 2014 7:11 pm    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

Have you read ftp://ftp.software.ibm.com/software/integration/wmq/docs/V7.0/csqzac07.pdf looking for MQFMT_ADMIN?
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
vignesh1988
PostPosted: Sun Mar 09, 2014 7:14 pm    Post subject: Reply with quote

Acolyte

Joined: 13 Apr 2013
Posts: 62
Location: Chennai

Yes, I saw this also..
But i dont know what is the correct place to add that functionality..
In Response Bag?

I can find out some where a small change will make my code work. But i am lost to find where is that..

Do you have any such samples?
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Facing MQ Return Code 3003 Error (MQRCCF_CFH_VERSION_ERROR)
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.