MQ Batch Toolkit

Chapter 4 Clearing a Queue by Matching String

Clearing a Queue by Matching String.

This section will describe how to clear messages from a queue that match a particular string.

Purpose

Use the ClearQByString command to clear the messages that contain a text string (or not) from a particular queue of a queue manager.

Syntax

{mqbt or mqbt.sh} ClearQByString -a Path_and_FileName_for_CommProfileDB -p Profile_Name -q Queue_Name {[-g Message_ID] [-m Correlation_ID]} [-s Start_Position] [-c Message_Count]

Function Name:
ClearQByString

Required Parameters:
-a The full path and filename for a CommProfileDB.properties file.
-p The name of a profile contained in the CommProfileDB.properties file.
-q The name of the queue (Note: Queue names are case sensitive.)
-t The text string to be searched for.

Optional Parameters:
-s Start position when getting messages from the queue. The default is 1.
-c Number of messages to be read from the queue. The default is all messages.
-I Perform case insensitive search.
-X Delete messages that do NOT match either message id or correlation id.

Example 1

  • Clear the messages with a particular text string in messages of a queue of a queue manager.

    Windows
    mqbt ClearQByString -a c:\CommProfileDB.properties -p MQA1 -q TEST01.Q -t test
    Unix
    ./mqbt.sh ClearQByString -a /Capitalware/MQBT/CommProfileDB.properties -p MQA1 -q TEST01.Q -t test

    Example 2

  • Clear the messages that do not contain a particular text string starting at message number 25 of a queue of a queue manager.

    Windows
    mqbt ClearQByString -a c:\CommProfileDB.properties -p MQA1 -q TEST01.Q -t test -s 25 -X
    Unix
    ./mqbt.sh ClearQByString -a /Capitalware/MQBT/CommProfileDB.properties -p MQA1 -q TEST01.Q -t test -s 25 -X

     




  • Copyright © 2004-2008 Capitalware Inc.  All Rights Reserved.