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 » General IBM MQ Support » MQ 2018 RC - hConn not valid

Post new topic  Reply to topic
 MQ 2018 RC - hConn not valid « View previous topic :: View next topic » 
Author Message
ryno
PostPosted: Tue Aug 20, 2002 2:55 pm    Post subject: MQ 2018 RC - hConn not valid Reply with quote

Novice

Joined: 22 Jul 2002
Posts: 17

while testing the sample program AMQSAICQ.C that was supplied from IBM, I compiled the code, built the pgm file, but when running it i get a reason code of 2018---MQRC_HCONN_ERROR The connection handle Hconn is not valid. I dont get it, my libararies and everything are set...anybody run into this???? the as400 is on 5.1 thanks-- oh one note, I did change the code so it wouldnt take any params like the original but that's it....it ran fine on my win2000 machine...heres the code

Code:


/*********************************************************/
/* Includes                                                     */
/*****************************************************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>

#include <cmqc.h>                          /* MQI           */
#include <cmqcfc.h>                        /* PCF                 */
#include <cmqbc.h>                         /* MQAI           */
                                                             
/************************************************************/
/* Function prototypes                                         */
/**********************************************************/
void CheckCallResult(MQCHAR *, MQLONG , MQLONG );
void CreateLocalQueue(MQHCONN, MQCHAR *);
                                                 
/***********************************************************/
/* Function: main                                       */
/*******************************************************/
int main()                 
{
   MQHCONN hConn;                         
   MQCHAR QMName[MQ_Q_MGR_NAME_LENGTH+1]="";
   MQLONG connReason;                     
   MQLONG compCode;                       
   MQLONG reason;                         
   MQCHAR QName[] = "TESTQUEUE";
   
   
   MQCONN(QMName, &hConn, &compCode, &connReason);   

   
   if (compCode == MQCC_FAILED)
   {
      CheckCallResult("Queue Manager connection", compCode, connReason);
      exit( (int)connReason);
   }

   
   CreateLocalQueue(hConn, QName);
   
   
   if (connReason != MQRC_ALREADY_CONNECTED)
   {
      MQDISC(&hConn, &compCode, &reason);
      CheckCallResult("Disconnect from Queue Manager", compCode, reason);         
   }
   return 0;
                                             
}



void CreateLocalQueue(MQHCONN hConn, MQCHAR *qName)
{
   MQLONG reason;                           
   MQLONG compCode;                         
   MQHBAG adminBag = MQHB_UNUSABLE_HBAG;   
   MQHBAG responseBag = MQHB_UNUSABLE_HBAG;
   MQHBAG resultBag;                       
   MQLONG mqExecuteCC;                     
   MQLONG mqExecuteRC;                     

   printf("\nCreating Local Queue %s\n\n", qName);


   mqCreateBag(MQCBO_ADMIN_BAG, &adminBag, &compCode, &reason);
   CheckCallResult("Create the admin 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;
 
   
mqAddString(adminBag, MQCA_Q_NAME, MQBL_NULL_TERMINATED, /*moved*/
         qName, &compCode, &reason);
   CheckCallResult("Add q name to admin bag", compCode, reason);

   
   mqAddInteger(adminBag, MQIA_Q_TYPE, MQQT_LOCAL, &compCode, &reason);
   CheckCallResult("Add q type to admin bag", compCode, reason);

   
   mqExecute(hConn,                   
             MQCMD_CREATE_Q,           
             MQHB_NONE,               
             adminBag,                 
             responseBag,             
             MQHO_NONE,               
             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("Disconnect from Queue Manager", compCode, reason);   
      exit(98);
   } 
   
   
   if ( compCode == MQCC_OK )
      printf("Local queue %s successfully created\n", qName);
   else
   {
 printf("queue %s failed: Completion Code = %d : Reason = %d\n",
          qName, compCode, reason);
     
     
      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("the result bag", compCode, reason);
mqInquireInteger(resultBag, MQIASY_REASON, MQIND_NONE, &mqExecuteRC,
                          &compCode, &reason);
 CheckCallResult("Get result bag", compCode, reason);
 printf("Error: = %d : Reason = %d\n", mqExecuteCC, mqExecuteRC);       
      }
   }

   if (adminBag != MQHB_UNUSABLE_HBAG)
   {
      mqDeleteBag(&adminBag, &compCode, &reason);
      CheckCallResult("Delete the admin bag", compCode, reason);
   }


   if (responseBag != MQHB_UNUSABLE_HBAG)
   {
      mqDeleteBag(&responseBag, &compCode, &reason);
      CheckCallResult("Delete the response bag", compCode, reason);
   }
} /* end of CreateLocalQueue */




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

}



thanks again


Last edited by ryno on Wed Aug 21, 2002 8:43 am; edited 1 time in total
Back to top
View user's profile Send private message
ryno
PostPosted: Tue Aug 20, 2002 6:11 pm    Post subject: Reply with quote

Novice

Joined: 22 Jul 2002
Posts: 17

the handle has to be valid if I get all good CC/RC on the MQCONN , right??
Back to top
View user's profile Send private message
ryno
PostPosted: Wed Aug 21, 2002 3:50 am    Post subject: Reply with quote

Novice

Joined: 22 Jul 2002
Posts: 17

no one has run into this one?
Back to top
View user's profile Send private message
ryno
PostPosted: Wed Aug 21, 2002 8:00 am    Post subject: Reply with quote

Novice

Joined: 22 Jul 2002
Posts: 17

interesting.....

i threw a statement in the code to let me know what the hConn value is and it is 0 everytime.....(as400)

but, when i ran it on my win2k box, that runs it fine it rturned a value of 8107680....

any ideas, im dyinf here. seems like everyone is viewing my issue but no takers....

thanks
Back to top
View user's profile Send private message
vennela
PostPosted: Wed Aug 21, 2002 9:32 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

On OS/390, CICS applications and on AS/400, applications running in compatibility mode the MQCONN call always returns MQHC_DEF_HCONN (which is 0 as far as my knowledge goes). So you don't have to worry about that. Also you don't have to have the MQCONN call in your pplication. It should connect automatically. Remove MQCONN call and try your app and see if it works.

Another try is to purge or do an ENDJOB against all the jobs, if any, that you have submitted to run this app previously.

Venny
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ryno
PostPosted: Thu Aug 22, 2002 7:59 am    Post subject: Reply with quote

Novice

Joined: 22 Jul 2002
Posts: 17

thanks for the rare reply, however Im not sure what you meant..I know being on the as400 you need not specify the Qmgr but no MCONN? how will it know what variable to use to hold the connection handle i.e. hConn? I did remove the line to no avail. thanks again
Back to top
View user's profile Send private message
ryno
PostPosted: Fri Aug 23, 2002 10:20 am    Post subject: Reply with quote

Novice

Joined: 22 Jul 2002
Posts: 17

okay...i went ahead and wrote another simple app that just puts a msg on a queue and the connection handle is also 0, so I guess it is valid having a vlaue of 0...back to the drawing board.
Back to top
View user's profile Send private message
ryno
PostPosted: Fri Aug 30, 2002 5:37 am    Post subject: Reply with quote

Novice

Joined: 22 Jul 2002
Posts: 17

quite possibly going to seek support from IBM, we cannot get any pcf working and it appears it could be an setup/authority issue, does anyone know anything about such. thank you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » MQ 2018 RC - hConn not valid
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.