BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
havmaage
Obsidian | Level 7

Hi, 

I am trying to connect to an MQ from as sas data step program. 

I have found this example code 

 

 data _null_;
   length hconn hobj cc reason 8;
   length rc hod hpmo hmd hmap hdata 8;
   length parms $ 200 options $ 200 action $ 3 msg $ 200;

   hconn=0;
   hobj=0;
   hod=0;
   hpmo=0;
   hmd=0;
   hmap=0;
   hdata=0;
   cc=0;	

   put '---------------- Connect to QMgr --------------';
   qmgr="MQS1";
   call mqconn(qmgr, hconn, cc, reason);
   if cc ^= 0 then do;
      if reason = 2002 then do;
         put 'Already connected to QMgr ' qmgr;
      end;
   else do;
      if reason = 2059 then
         put 'MQCONN: QMgr not available... 
		    needs to be started';
      else
         put 'MQCONN: failed with reason= ' reason;
      goto exit;
      end;
   end;
   else put 'MQCONN: successfully connected to QMgr ' qmgr;

exit: 

run;

I am running this code in SAS 9.2 from SAS-EG 4.3 connected to a metadata server just to very that i can connect to our MQ  

 

I am wondering how i should specify hostname, port to the remote Queue just to very the connection. Do i need to have some

module installed to dfo this. ? 

This code returns -1 in reason. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

1.The software needed for CORBA/MSMQ/MQSeries communications is SAS Integration Technologies.

Since you use EG, your server has this component licenced.

 

2. Did you read these pages? 

WebSphere MQ CALL Routines

Usage Note 15291: MQCONN: failed with reason= -1 when using the SAS Interface to WebSphere MQ

View solution in original post

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

1.The software needed for CORBA/MSMQ/MQSeries communications is SAS Integration Technologies.

Since you use EG, your server has this component licenced.

 

2. Did you read these pages? 

WebSphere MQ CALL Routines

Usage Note 15291: MQCONN: failed with reason= -1 when using the SAS Interface to WebSphere MQ

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 784 views
  • 1 like
  • 2 in conversation