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 Discussion » C Client program not picking up environment variable values

Post new topic  Reply to topic Goto page 1, 2  Next
 C Client program not picking up environment variable values « View previous topic :: View next topic » 
Author Message
j1
PostPosted: Tue Mar 21, 2006 11:28 am    Post subject: C Client program not picking up environment variable values Reply with quote

Centurion

Joined: 23 Jun 2003
Posts: 139

Hi,

I am trying to run a C client from a Solaris Box, connecting to a Qmgr on another soalris box. I am getting the MQRC 2058, and the program dosent seem to be picking up either the MQSERVER or MQCHLLIB/MQCHLTAB variable values for the MQCONN call. The same environment variable valies work for the amqsput program and I compred the code of my program with amqsput and I dont see any major difference. Am i missing out something simple. Do let me know. i also looked through the other posts, but didnt find anything

Rgds
Back to top
View user's profile Send private message
j1
PostPosted: Tue Mar 21, 2006 11:30 am    Post subject: Reply with quote

Centurion

Joined: 23 Jun 2003
Posts: 139

i also tried running it as

Quote:
. <prog name>


instead of just

Quote:
<prog name>


but get an

Quote:
ksh: syntax error: `(' unexpected


error.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Mar 21, 2006 11:48 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

So when you run amqsputc from the same shell as you run your program, then amqsputc connects to the queue manager, but your program doesn't?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
wschutz
PostPosted: Tue Mar 21, 2006 11:53 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

are you "exporting" those variables?
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
j1
PostPosted: Tue Mar 21, 2006 11:56 am    Post subject: Reply with quote

Centurion

Joined: 23 Jun 2003
Posts: 139

yup, am exporting the variables. and am running ampqsputc without the "." and it connects just fine.
Back to top
View user's profile Send private message
j1
PostPosted: Tue Mar 21, 2006 11:59 am    Post subject: Reply with quote

Centurion

Joined: 23 Jun 2003
Posts: 139

here is what it looks like :

Quote:


#include <cmqc.h>
#include <cmqxc.h>
#include <stdio.h>
#include <string.h>
int main()
{
MQHCONN hConn;
MQHOBJ hObject;
char qmgrName[50];
MQLONG iCompCode;
MQLONG iReason;
MQLONG iMessageLen;
MQBYTE buffer[1000];
MQLONG iOpenOptions ;

MQOD mqod = {MQOD_DEFAULT};
MQMD mqmd = {MQMD_DEFAULT};
MQPMO mqpmo = {MQPMO_DEFAULT};

MQCNO mqcno = {MQCNO_DEFAULT} ;
MQCD mqcd = {MQCD_CLIENT_CONN_DEFAULT};

qmgrName[0] = 0;

MQCONN(qmgrName, /* queue manager */
&hConn, /* connection handle */
&iCompCode, /* completion code */
&iReason);

/* MQCONNX(qmgrName,
&mqcno,
&hConn,
&iCompCode,
&iReason);*/
printf(" Completion Code %ld\n", iCompCode);
printf(" CONNX Reason Code %ld\n", iReason);
printf(" Conn name %s\n", mqcd.ConnectionName);
printf(" Channel Name name %s\n", mqcd.ChannelName);
printf(" Qmger Name %s\n", qmgrName);

[/code]
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Mar 21, 2006 12:02 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Did you link your program against the client libraries, or against the server libraries?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
j1
PostPosted: Tue Mar 21, 2006 12:14 pm    Post subject: Reply with quote

Centurion

Joined: 23 Jun 2003
Posts: 139

i am compiling it with the '-lmqm' suffix. Initially when i ran the program it gave me an error that it couldnt find the libmqm and libmqmz.so files, so i just copied them over from the server to /usr/lib. Do you think that may be the problem What exactly do you mean by linking against client vs server libraries. pls pardon the novice progammer who has only coded ESQL fr the last 3 years. A c client coding task has been fosited upon me...
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Mar 21, 2006 12:19 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzal.doc/csqzal10137.htm

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzal.doc/csqzal10136.htm
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
wschutz
PostPosted: Tue Mar 21, 2006 12:19 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

he means: -lmqic

and I thought the install makes symlinks for the mq libs in /usr/lib for you, this is generally a bad idea:
Quote:
so i just copied them over from the server to /usr/lib.

_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
clindsey
PostPosted: Tue Mar 21, 2006 1:18 pm    Post subject: Reply with quote

Knight

Joined: 12 Jul 2002
Posts: 586
Location: Dallas, Tx

Quote:

I am trying to run a C client from a Solaris Box, connecting to a Qmgr on another soalris box


You should install WMQ client code on this box. Let the install put the code in the correct place and let it create the links.
Clients are a free download. Go to the SupportPacs page at http://www-1.ibm.com/support/docview.wss?rs=171&uid=swg27007197#1
and get either MACY (V 5.3) or MP6M (V 6.0)

Charlie
Back to top
View user's profile Send private message
j1
PostPosted: Wed Mar 22, 2006 6:27 am    Post subject: Reply with quote

Centurion

Joined: 23 Jun 2003
Posts: 139

Hi All,

Thanks for the inputs. I did download the supportpacs, but the samples with the 6.0 support pacs, dont seem to have SSL support. Not sure if the support pac itself has SSL Support. The 5.3 support pac seems to have SSL support, but I beleive the way SSL works with 5.3 and 6.0 is different. correct ?

Coming back to the Code I was building, Compiling with the client libraries did resolve the MQRC 2058 but am now getting a MQRC 2277 on my MQCONN call. I think it may be one of the connection parameters I am passing in. Looking into the client side error logs indicates that the Channel Name wasnt getting picked up from the MQSERVER variable. Here is the exact error message:

Quote:

AMQ9498: The MQCD structure supplied was not valid.

EXPLANATION:
The value of the 'ChannelName' field has the value '0'. This value is invalid
for the operation requested.


Also, below is an excerpt of the program, with sensitive information masked out. I wonder if it is the "mqcno.ClientConnPtr=&mqcd;" line.
Thanks again for the help.

Code:

    MQHCONN    hConn;   
    MQHOBJ     hObject;       
    char       qmgrName[50];
    MQLONG     iCompCode;   
    MQLONG     iReason;     
    MQLONG     iMessageLen;
    MQBYTE     buffer[1000];         
    MQLONG      iOpenOptions  ;
    MQOD    mqod = {MQOD_DEFAULT};     
    MQMD    mqmd = {MQMD_DEFAULT};   
    MQPMO   mqpmo = {MQPMO_DEFAULT}; 
    MQCNO   mqcno = {MQCNO_DEFAULT} ; 
    MQCD    mqcd  = {MQCD_CLIENT_CONN_DEFAULT}; 
    MQSCO   mysco = {MQSCO_DEFAULT};



    qmgrName[0] = 0;

/* For SSL **/

strncpy(mysco.KeyRepository, "something here",MQ_SSL_KEY_REPOSITORY_LENGTH);

printf("Key Repository:%s\n", mysco.KeyRepository);
/** Specify CipherSpec */
strcpy(mqcd.SSLCipherSpec,"cipher spec here");
mqcno.SSLConfigPtr = &mysco;
mqcno.ClientConnPtr=&mqcd;
mqcno.Version = MQCNO_VERSION_4;
printf("CipherSpec :%s\n", mqcd.SSLCipherSpec);

 /*MQCONN(qmgrName,                 
          &hConn,                   
          &iCompCode,             
          &iReason);  */
 
    MQCONNX(qmgrName,
         &mqcno,
         &hConn,
         &iCompCode,
         &iReason);

Back to top
View user's profile Send private message
wschutz
PostPosted: Wed Mar 22, 2006 7:04 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

If you want to use the MQCONNX call, you need to specify MQCD.ChannelName and MQCD.ConnectionName ('host(port)').

If you do use MQCONNX, then the MQSERVER / MQCHLLIB / TAB environment variables are ignored.

V6 of the client does support SSL.
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
jefflowrey
PostPosted: Wed Mar 22, 2006 7:07 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

wschutz wrote:
If you do use MQCONNX, then the MQSERVER / MQCHLLIB / TAB environment variables are ignored.


To clarify a bit - the environment variables are ignored because you have said "I will specify all of the details of the client channel myself". That's what the MQCONNX is for.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
j1
PostPosted: Wed Mar 22, 2006 7:14 am    Post subject: Reply with quote

Centurion

Joined: 23 Jun 2003
Posts: 139

I would like to use the channel table set up in this case, but arent we constrained to use the MQCONNX call to specify cipherspec, key repository path on the client side etc..., since those are also part of the connection options structure.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » General Discussion » C Client program not picking up environment variable values
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.