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 Java / JMS » MQSC Commands using Java

Post new topic  Reply to topic
 MQSC Commands using Java « View previous topic :: View next topic » 
Author Message
jigjim
PostPosted: Tue May 04, 2004 11:59 am    Post subject: MQSC Commands using Java Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Hi,

I am using Java langaue to do a MQClient Connection to a MQ Series server on z/OS.

When i execute MQSC commands on the SYSTEM.COMMAND.INPUT Q, i get the following error message of type CSQN205I ....

RETURN=00D50211, REASON=FFFFFFFF ,

00D50211
Explanation: The command processor got a command from the system-command-input queue, but was unable to process it because the command message consisted of blank characters only.

I send the command in JAva as :

Code:
sendM = new MQMessage();
sendM.writeUTF("DISPLAY QMGR ALL");       
sendM.messageType = MQC.MQMT_REQUEST;
sendM.format = MQC.MQFMT_STRING;
sendM.replyToQueueName = replyQueueName;
sendQ.put(sendM, pmo);


Can somebody pls help me what is wrong in the above code and why it sends blank strings only?

Thanks

Jignesh
Back to top
View user's profile Send private message
EddieA
PostPosted: Tue May 04, 2004 12:37 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Use writeString, not writeUTF. writeUTF prefixes the data with a length field.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
jigjim
PostPosted: Wed May 05, 2004 9:18 am    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Thanks,

I got it wworking with readString(). I now am facing problems reading it:
Following is the code i use to read it:

Code:
replyQ = qmgr.accessQueue (replyQueueName, MQC.MQOO_INPUT_AS_Q_DEF, "", "", "");
               
gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_CONVERT ;
recvM = new MQMessage();
replyQ.get(recvM, gmo);
String msgLine = recvM.readLine();
int lineLength = msgLine.length();
System.out.println("The message Line length is : "+lineLength);
System.out.println("The Line message is : "+msgLine);


I get the following responses:
On first run:
Quote:
The message Line length is : 59
The Line message is : CSQN205I COUNT= 3, RETURN=00000000, REASON=00000000


On second run: (The information i need)
Quote:
The message Line length is : 1412
The Line message is : CSQM409I &MQO1 QMNAME(MQO1 ) DESCR(MQO1, IBM MQSeries for OS/390 - V5.2 ) PLATFORM(MVS ) CPILEVEL( 100) CMDLEVEL( 531) CCSID( 500) MAXPRTY( 9) MAXMSGL( 104857600) SYNCPT(AVAILABLE ) QSGNAME( ) COMMANDQ(SYSTEM.COMMAND.INPUT ) DEADQ(MQO1.DEAD.QUEUE ) TRIGINT( 999999999) MAXHANDS( 256) MAXUMSGS( 10000) EXPRYINT(OFF ) AUTHOREV(DISABLED ) INHIBTEV(DISABLED ) LOCALEV(DISABLED ) REMOTEEV(DISABLED ) STRSTPEV(ENABLED ) PERFMEV(DISABLED ) CONFIGEV(DISABLED ) CHADEXIT( ) CLWLDATA( ) CLWLEXIT( ) CLWLLEN( 100) REPOS( ) REPOSNL(MQO1MVS.NL.CLUSTERS.WITH.FULL.REPOSITORIES ) QMID(MQO1.BB236140F14A6901 ) DEFXMITQ( ) SSLKEYR( ) SSLCRLNL( ) SSLTASKS( 0) IGQ(DISABLED ) IGQAUT(DEF ) IGQUSER( ) ALTDATE(2004-05-03 ) ALTTIME(10.27.25)


On third run:
Quote:
The message Line length is : 57
The Line message is : CSQ9022I &MQO1 CSQMDRTS ' DISPLAY QMGR' NORMAL COMPLETION


Is there any way i can read the whole message at one go?
Also is it possible as in PCF to get all the attributes setup in an object so that i can access them using methods like getParameter() ...


I also tried the below alternative method to read the msg, but faced the same probs.

Code:
/*
int msgLength = recvM.getMessageLength();
String msgText = recvM.readString(msgLength);
System.out.println("The message length is : "+msgLength);
System.out.println("The message is : "+msgText);
*/


Thanks
jignesh
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 05, 2004 10:06 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

To read a message fully, use the readFully() method.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
EddieA
PostPosted: Wed May 05, 2004 10:25 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
To read a message fully, use the readFully() method.

That's not the issue. The problem is that the replies sent back from Z/OS *always* come as multiple messages. From the manual:
Quote:
Each request message correctly processed by WebSphere MQ produces at least two reply messages. Each reply message contains a single WebSphere MQ user message.

There's no way you're going to change that.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
jigjim
PostPosted: Wed May 05, 2004 10:36 am    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Can you give me a sample code on how to use it. I tried the following and got the following error message:
Code:
int len = recvM.readInt();
System.out.println("msg length is: "+len);
byte[] data = new byte[len];
System.out.println("Initialising the data array");
recvM.readFully(data,0,len);
String msg = new String(data);
System.out.println("the msg is: "+msg);

The response i got was:

Quote:
*** In MQSCRecvClient ***
Connecting to queue manager at host: ABC port : 1414 channel: SYSTEM.DEF.SVRCONN
Connected to: MQO1
Command Q for MQO1 is : SYSTEM.COMMAND.INPUT
msg length is: 1129533773
java.lang.OutOfMemoryError
Exception in thread "main"


This is only for a one line display of DISPLAY QMGR ALL. IF i do something like DISPLAY QUEUE (*) then it will be a very big message.

Please post a sample code, if you have one

Thanks

Jignesh
Back to top
View user's profile Send private message
EddieA
PostPosted: Wed May 05, 2004 11:32 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
int len = recvM.readInt()

You are reading the 1st 4 bytes of a TEXT message, but telling telling Java that it's an INT. Of course this will give screwy results.

Use getDataLength if you want to find out how big a message is.
Quote:
IF i do something like DISPLAY QUEUE (*) then it will be a very big message.

No. It will probably send this back as multiple messages. The COUNT field of the 1st message will tell you how many messages, in total, the reply is. And there also "may" be multiple blocks of replies.

This is all explained in: WebSphere MQ for z/OS System Administration Guide.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
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 Java / JMS » MQSC Commands using Java
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.