Interesting Example Filters for MO71

In the recent video about MO71 filters, there were a few examples shown at the end of the video to illustrate some other things you can do with filters (video below deliberately starts 8m 46secs in).

Here are a few more details on those filters to allow you to use them, copy and paste them into the filter manager, etc.

Filter: ChsStatus

N.B. Use this example filter on a Channel Status list dialog.

This filter allows you to highlight those sender channels whose status is stopped or retrying on all your queue managers. It uses the bg function to set the background colour based on the status and the fg function to set the foreground colour also based on the status, and filters the display to only show those channels which have a chltype of sender.

qm("*");
bg(status=stopped  ,red);
bg(status=retrying, dred);
fg(status=retrying, white);
chltype=sender

Filter: MsgAge

N.B. Use this example filter on a Message list dialog (not a Queue list).

This filter highlights messages with a high priority that haven’t been processed quickly enough, by detecting those which have been on the queue for more than 60 seconds. We see the use of a function called mqtime which can take an MQ date and MQ time field (such as the putdate and puttime) and use them to calculate the time that the message was put onto the queue in seconds. Then we use the function _time to obtain the current time in seconds, and the user variable @Age then holds the difference between the two giving us the number of seconds that the message has been on the queue.
Then we use the bg function to set the background colour based on the Priority and the calculated age. The line with the # symbol causes the @Age variable to be shown as a column in the dialog. The last statement is 1 which ensures the filter always returns true and so every line is displayed.

@PutTime := mqtime(putdate,puttime);
@Age     := _time - @PutTime;
@Age#    := @Age;
bg(Priority > 7 && @Age > 60, red);
1

Filter: RetIntvl

N.B. Use this example filter on a Queue list dialog.

This filter shows how you can use the Retention Interval field on an MQ Queue definition. This field is provided by MQ for you to document how long queues should be kept around. It is not acted on by MQ though. It is up to you as a user to check when queues have lived beyond their Retention Interval. This filter can do that for you. Most of the features used here we have seen already in the above two filters, however, it also illustrates the use of the sort function, sorting by our user variable @sort so that the queues that have lived longer than they should are shown at the top of the dialog.

@sort := 999999999;
if (crdate) 
{
  @qtime   := mqtime(crdate,crtime);   
  @Age#   :=(_time - @qtime)/3600;

  if (retintvl != 999999999)
  {
    @Remain# := retintvl - @Age#;
    bgcell(@Age# >= retintvl#, red, @Remain#); 
    @sort:= @Remain#;
  }
}
sort(@sort);

1

As with all tools, the best way to learn is to try things out, so I hope these examples will encourage you to try other things out and learn how these powerful filters can help you to manage your MQ queue managers. I’d love to hear how you get on.

If you don’t yet have a license for MO71, and you’d like to have a go with the product, please drop me a line at support@mqgem.com to ask for a trial license.

Advertisements

2 thoughts on “Interesting Example Filters for MO71

    • Thanks for your feedback. As per the email you were sent from our support team, the MsgAge filter is intended for use on a Message List dialog rather than a Queue List dialog. I have made an update to the blog post to make that clear. Hopefully your feedback will result in less confusion for any future readers, so thank you for raising it with us.

      Like

The team at MQGem would love to hear what you think. Leave your comments here.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s