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 » Using getenv for key repo path

Post new topic  Reply to topic
 Using getenv for key repo path « View previous topic :: View next topic » 
Author Message
gopalsamant
PostPosted: Mon Nov 22, 2004 6:57 pm    Post subject: Using getenv for key repo path Reply with quote

Novice

Joined: 24 Sep 2004
Posts: 17

Hi all, i am facing a problem reading the unix enviornment variable. actually my mq program is in C and i am setting the key repo path in the profile file. but when i read the varaible set in profile file using getenv function i get blank. but setnev is working fine. Can some guide me with what could be the issue. below is the syntax in profile file and in the C client program.

profile file:
MQKEYREPO=/cq1/bin/ssl/key; export MQKEYREPO

C client program :
strcpy(ls_KeyRepo,(char *)getenv( "MQKEYREPO" ));
strcpy(sco.KeyRepository, ls_KeyRepo ) ;
Back to top
View user's profile Send private message
kirani
PostPosted: Mon Nov 22, 2004 11:31 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Do you see the env variable set when you logon to the box?
Try printing the env variable within your program after getenv function.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
gopalsamant
PostPosted: Mon Nov 22, 2004 11:34 pm    Post subject: Reply with quote

Novice

Joined: 24 Sep 2004
Posts: 17

If i do a echo on unix box then i do get the value. but when i print it after reading it in the C progam it comes out to be blank. i guees the execution of this c program is opening another shell or something like that i dont know exactly what.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Nov 23, 2004 6:02 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

If the environment variable is not visible to your program, it's either because your program cleared the environment, or because your program was not started in the environment you think it was.

Let's go with the later possibility, since it's significantly more likely.

How are you starting this program? From the prompt? From cron or similar? From initd or similar? From triggering?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
gopalsamant
PostPosted: Tue Nov 23, 2004 6:44 pm    Post subject: Reply with quote

Novice

Joined: 24 Sep 2004
Posts: 17

Actaully here is what we are doing
cc -c test.c -o test.o
ld -o /cq1/bin/test.so test.o -G -bnoentry -bexpall -lmqic -lc

in sql
drop library test_lib ;

create or replace LIBRARY test_lib is '/cq1/bin/test.so';

create or replace procedure test_1(param)
as external
name "test1"
library test_lib
language C
parameters ( params);

then programatically we are calling this procedure for MQ which give error 2381 which is key repo not found and seeing the logfile show the varaible i have explained in the start of the issue is returning null.
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 » IBM MQ API Support » Using getenv for key repo path
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.