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 » Error when using PCF to clear a queue

Post new topic  Reply to topic
 Error when using PCF to clear a queue « View previous topic :: View next topic » 
Author Message
paul0al
PostPosted: Mon Aug 26, 2002 2:38 pm    Post subject: Error when using PCF to clear a queue Reply with quote

Apprentice

Joined: 30 May 2002
Posts: 26

I have written a VB program to clear the contents of a queue using PCF. The program compiles and executes without errors, but my queue never gets cleared. I wrote the PCF following the "pcfsamp" example from IBM (included with MQSeries 5.2.1). I'm using Win2k. It would be great if anyone can take a look at the code and tell me what I am doing wrong.

Code:

Private Type PCFCommand
    commandHeader As MQCFH
    commandParameter As MQCFST
    string As String
End Type


Code:

Private Sub clearQueueCommand(ByVal machineName As String)
    Dim machine As Collection
    Dim Command As PCFCommand
   
    Set machine = gTargetMachines.Item(machineName)
   
    MQCFH_DEFAULTS Command.commandHeader
    Command.commandHeader.MsgSeqNumber = MQCFC_LAST
    Command.commandHeader.Command = MQCMD_CLEAR_Q
    Command.commandHeader.ParameterCount = 1
   
    MQCFST_DEFAULTS Command.commandParameter
    Command.commandParameter.StrucLength = MQCFST_STRUC_LENGTH_FIXED + MQ_Q_NAME_LENGTH
    Command.commandParameter.Parameter = MQCA_Q_NAME
    Command.string = machine.Item("queueName")
    Command.commandParameter.StringLength = Len(Command.string)

    SendPCFCommand Command
End Sub

Private Sub SendPCFCommand(ByRef Command As PCFCommand)
    Dim msgDescriptor As MQMD
    Dim putOptions As MQPMO
    Dim CompCode As Long
    Dim Reason As Long
   
    MQMD_DEFAULTS msgDescriptor
    msgDescriptor.ReplyToQMgr = "QM_alert03"
    msgDescriptor.MsgType = MQMT_REQUEST
    msgDescriptor.ReplyToQ = "SYSTEM.DEFAULT.LOCAL.QUEUE"
    msgDescriptor.Format = MQFMT_ADMIN
   
    MQPMO_DEFAULTS putOptions
    putOptions.Options = MQPMO_NO_SYNCPOINT
   
    MQPUTAny gHandleToTheQueueManager, gHandleToTheQueue, msgDescriptor, putOptions, Len(Command), Command, CompCode, Reason
   
    If CompCode <> MQCC_OK Then
        MsgBox "MQPUTAny failed with " & CompCode
    End If
   
End Sub


thanks in advance,
paul.
Back to top
View user's profile Send private message
jc_squire
PostPosted: Mon Aug 26, 2002 5:36 pm    Post subject: Reply with quote

Centurion

Joined: 14 Apr 2002
Posts: 105
Location: New Zealand

Hi Paul,

Queues cannot be cleared if an application or MCA has them open which could be your problem.

Regards
_________________
J C Squire
IBM Certified Specialist - MQSeries
Back to top
View user's profile Send private message
dgolding
PostPosted: Mon Aug 26, 2002 11:05 pm    Post subject: Re: Error when using PCF to clear a queue Reply with quote

Yatiri

Joined: 16 May 2001
Posts: 668
Location: Switzerland

"It would be great if anyone can take a look at the code and tell me what I am doing wrong."

Well, using Visual Basic for a start

Seriously (my VB is crap so maybe I'm getting it wrong):

What error code do you get on the PUT?
Where do you open the queue?

NB By leaving the ReplyToQManager blank, you're currently connected queue manager is filled in - best practise (saves hard-coding queue manager names).
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Error when using PCF to clear a queue
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.