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 » Java PCF - MQIACF_FORCE to clear open queue fails

Post new topic  Reply to topic
 Java PCF - MQIACF_FORCE to clear open queue fails « View previous topic :: View next topic » 
Author Message
petmor
PostPosted: Tue Jul 09, 2013 10:48 am    Post subject: Java PCF - MQIACF_FORCE to clear open queue fails Reply with quote

Apprentice

Joined: 20 Jun 2002
Posts: 45
Location: Pasadena, CA

Hi,

I wrote some Java using the PCF API to clear unwanted messages from queues. Here is an excerpt:

for (int i = 0; i < s.length; i++) {
PCFMessage request = new PCFMessage(CMQCFC.MQCMD_CLEAR_Q);
request.addParameter(CMQC.MQCA_Q_NAME, s[i]);

try {
pcfCM.agent.send(request);
} catch (PCFException e) {
.
.
.
}

This works fine except on queues held open by a process. I want to clear those queues also, so I added a line "request.addParameter(CMQCFC.MQIACF_FORCE, CMQCFC.MQFC_YES);" to specify FORCE, but this results in a "3020 (0BCC) (RC3020): MQRCCF_PARM_COUNT_TOO_BIG'". The code with FORCE is pasted below.

for (int i = 0; i < s.length; i++) {
PCFMessage request = new PCFMessage(CMQCFC.MQCMD_CLEAR_Q);
request.addParameter(CMQC.MQCA_Q_NAME, s[i]);
request.addParameter(CMQCFC.MQIACF_FORCE, CMQCFC.MQFC_YES);

try {
pcfCM.agent.send(request);
} catch (PCFException e) {
.
.
.
}

Obviously I am not using the option properly, so what am I doing incorrectly, and what is the proper way to specify FORCE without throwing the RC3020?

Thanks!

Peter
Back to top
View user's profile Send private message Send e-mail AIM Address
mqjeff
PostPosted: Tue Jul 09, 2013 11:06 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Well, first of all, there isn't a valid FORCE parameter for the Clear Queue PCF message...

Secondly, you really don't likely want to clear messages out from underneath a running application.

Thirdly, if you do want to clear them, the only reliable way is to GET them.
Back to top
View user's profile Send private message
petmor
PostPosted: Tue Jul 09, 2013 12:42 pm    Post subject: Reply with quote

Apprentice

Joined: 20 Jun 2002
Posts: 45
Location: Pasadena, CA

Hi,

Thanks mqjeff for your reply. I only tried Force because the suggested Programmer Response for MQRC4004 recommends "Wait until the object is not in use, and then retry the operation. Alternatively specify Force as MQFC_YES for a change command." I would not have known otherwise without your input.

I agree it is a bad idea to purge messages from open queues. This process runs only on one of our development servers as a clean-up job, where the purged messages will not be missed.

I'll try a GET instead. Thanks again!

Peter
Back to top
View user's profile Send private message Send e-mail AIM Address
mqjeff
PostPosted: Tue Jul 09, 2013 12:55 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

petmor wrote:
Thanks mqjeff for your reply. I only tried Force because the suggested Programmer Response for MQRC4004 recommends "Wait until the object is not in use, and then retry the operation. Alternatively specify Force as MQFC_YES for a change command."

That's being technical about the meaning of "change command".

It means a Change PCF message or an Alter MQSC command, neither of which are the Clear command.

MQExplorer gives you a popup to either use Clear or to use MQGET - again because CLEAR doesn't have a FORCE option.

In general, if you're doing anything with PCF messages, keep the docs handy.
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 » Java PCF - MQIACF_FORCE to clear open queue fails
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.