Examples of mass template association using the CLI

The following examples illustrate how you can use the maketmpltassoc command syntax to create or delete mass template associations:

Display the matches without creating the association.

Use ID SA. Associate to an event template applied to local queues.

maketmpltassoc -n SA e MQLocalQueue msgOnDLQ "MADRID!MADRID!DLQ"

The template is named msgOnDLQ with instance names that match MADRID!MADRID!DLQ



Show the use of the -n, -p and e switches applied to all local queues.

maketmpltassoc -n UserName -p MyPassword e MQLocalQueue 1QDepthOver25Pct "XPQPASA!PRODUCTS!.*"

In this example:

  • -n: prints matches and does not create the associations.
  • -p: followed by the password so you are not prompted for a password. When using this command in a script, put -n and -p (followed by username and password respectively) in every line of a batch script file.
  • e: Event type template associating.

 



Show the command syntax when two event templates have similar names (such as 1QDepthOver25Pct and 1QDepthOver25PctABC) and you want to exactly match the shorter name.

To solve this issue, you must define word boundaries by enclosing the match string in word boundaries "\b and \b".

maketmpltassoc UserName -p MyPassword e MQLocalQueue "\b1QDepthOver25Pct\b" "[A-Z0-9]*![A-Z0-9]*!SYSTEM.AD-MIN.QMGR.EVENT"

The above example associates only the SYSTEM.ADMIN.QMGR.EVENT queue from all monitored nodes available in Monitor Console to the template 1QDepthOver25Pct.

 



Associate all local queues for all queue managers on any server which contains CLAIM.

This example associates all local queues for all queue managers on any server which contains CLAIM. This means the regex pattern matches all local queue objects under any queue manager name, or any node name, that contains the string CLAIM in either the node name, queue manager name, or queue name. The regular expression filters out all the qualifiers before and after the string.

maketmpltassoc -n -s userID history MQLocalQueue 1compName_LocalQueues "^.*CLAIM.*$"
maketmpltassoc -s userID history MQLocalQueue 1compName_LocalQueues "^.*CLAIM.*$"

The beginning (^) and ending ($) anchors reduce unintended matches. When beginning and ending anchors are used, two wildcards must be explicitly added, for example "^.*e.*$" matches anything containing the letter e. Note that * means repeat zero or more times and applies to the prior token in this case the . (period) which is a wildcard meaning any character except the newline character.

The first command, with -n, lists the queues that qualify. The second command does the associations. Note the use of the suggested naming convention of 1CompanyName at the beginning of the template name.

Usually it is better to be more specific than general. The example below cannot fail if your intention is just to match the node name.

If, at some future time, CLAIM is added somewhere in the queue manager or queue name for a non-CLAIM node name, the command syntax above is difficult to test. Instead of the above command example, use the following:

maketmpltassoc -n -s userID history MQLocalQueue 1compName_LocalQueues "^CLAIM!.*!.*$"
maketmpltassoc -s userID history MQLocalQueue 1compName_LocalQueues "^CLAIM!.*!.*$"

 



Associate all local queues that contain the string CLAIM for all queue managers on any server.

maketmpltassoc -n UserName -p MyPassword event MQLocalQueue 1compName_queueEightyPercent "^.*!.*!.*CLAIM.*$"

This example is similar to the previous example, but is shows a search for Queue Name Only, containing CLAIM anywhere in the queue name. Use '^.*!.*!.*CLAIM.*$' which means any queue manager on any node that contains CLAIM anywhere in the queue name. The dot means any character except newline character. The asterisk means match the previous token (any character except newline character) zero or more times.

Assume the following queue names: Inventory, Inventory_Sales, and Sales. If you only want to match Inventory, use ^ and $ to granularize the match. For example:

  • ^INVENTORY$
  • ^.*ORY$

The command might return the following:

Would create association for the topic: 'XPQPASA!CONFMGR!C_CLAIMS: using the rule name: 1compName_queueEightyPercent12223711290
Would create association for the topic: 'XPQPASA!PRODUCTS!B_CLAIMS: using the rule name: 1compName_queueEightyPercent12223711291
Would create association for the topic: 'XPQPASA!PRODUCTS!CLAIMS_INQUIRY1: using the rule name: 1compName_queueEightyPercent12223711294
Would create association for the topic: 'XPQPASA!PRODUCTS!CLAIMS_ISSUE_PAYMENT: using the rule name: 1compName_queueEightyPercent12223711298
Would create association for the topic: 'XPQPASA!PRODUCTS!CLAIMS_ONGOING: using the rule name: 1compName_queueEightyPercent12223711299
Would create association for the topic: 'XPQPASA!PRODUCTS!CLAIMS_REJECTED: using the rule name: 1compName_queueEightyPercent122237112910
Would create association for the topic: 'XPQPASA!PRODUCTS!CLAIMS_WIP: 1compName_using the rule name: queueEightyPercent122237112911
Would have successfully notified the Event Service that there are 7 rules to be reloaded.

To perform the same operation but more specifically (only queue manager 'PRODUCTS') using ' ^.*!PRODUCTS!.*CLAIM.*$' - This means, on any node, queue manager 'PRODUCTS' (determined by the exclamation points on both sides of PRODUCTS), then 'CLAIM' anywhere in the queue name.

maketmpltassoc -n UserName -p MyPassword event MQLocalQueue 1compName_queueEightyPercent "^.*!PRODUCTS!.*CLAIM.*$"

The command might return the following:

Would create association for the topic: 'XPQPASA!PRODUCTS!B_CLAIMS: using the rule name: 1compName_queueEightyPercent12222798470
Would create association for the topic: 'XPQPASA!PRODUCTS!CLAIMS_INQUIRY1: using the rule name: 1compName_queueEightyPercent12222798473
Would create association for the topic: 'XPQPASA!PRODUCTS!CLAIMS_ISSUE_PAYMENT: using the rule name: 1compName_queueEightyPercent12222798477
Would create association for the topic: 'XPQPASA!PRODUCTS!CLAIMS_ONGOING: using the rule name: 1compName_queueEightyPercent12222798478
Would create association for the topic: 'XPQPASA!PRODUCTS!CLAIMS_REJECTED: using the rule name: 1compName_queueEightyPercent12222798479
Would create association for the topic: 'XPQPASA!PRODUCTS!CLAIMS_WIP: using the rule name: 1compName_queueEightyPercent122227984710
Would have successfully notified the Event Service that there are 6 rules to be reloaded.

 



Search for any queue manager or queue name starting with CICS1.

maketmpltassoc -n UserName -p MyPassword event MQLocalQueue 1compName_queueEightyPercent "^.*!CICS1!*"

The command might return the following:

Would create association for the topic: 'XPQPASA!CICS1!BRKR.REQ: using the rule name: 1compName_queueEightyPercent12222735930
Would create association for the topic: 'XPQPASA!CICS1!SYSTEM.CLUSTER.TRANSMIT.QUEUE: using the rule name: 1compName_queueEightyPercent12222735931
Would create association for the topic: 'XPQPASA!APP1!CICS1: using the rule name: 1compName_queueEightyPercent12222735932
Would create association for the topic: 'XPQPASA!APP2!CICS1: using the rule name: 1compName_queueEightyPercent12222735933
Would create association for the topic: 'XPQPASA!CICS1!APP1: using the rule name: 1compName_queueEightyPercent12222735934
Would create association for the topic: 'XPQPASA!CICS1!APP2: using the rule name: 1compName_queueEightyPercent12222735935
Would create association for the topic: 'XPQPASA!CICS1!CICS2: using the rule name: 1compName_queueEightyPercent12222735936
Would create association for the topic: 'XPQPASA!CICS2!CICS1: using the rule name: 1compName_queueEightyPercent12222735937

 



Below more restrictively 'CICS1' must be at beginning of Queue Name because of adding $.

Maketmpltassoc -n UserName -p MyPassword event MQLocalQueue 1compName_queueEightyPercent "^.*!CICS1!*$"

Also because of the zero to N occurrences of only '!' following 'CICS1' before end of the string, that limits the Queue Name to have no other trailing characters.

The command might return the following:

Would create association for the topic: 'XPQPASA!APP1!CICS1: using the rule name: 1compName_queueEightyPercent12222739450
Would create association for the topic: 'XPQPASA!APP2!CICS1: using the rule name: 1compName_queueEightyPercent12222739451
Would create association for the topic: 'XPQPASA!CICS2!CICS1: using the rule name: 1compName_queueEightyPercent12222739452
Would have successfully notified the Event Service that there are 3 rules to be reloaded.

 



Match a specific string in the queue manager names.

maketmpltassoc -n UserName -p MyPassword event MQLocalQueue 1compName_queueEightyPercent "^.*!CICS1!.*$"

The match criteria in the queue manager name is CICS1.

The command might return the following:

Would create association for the topic: 'XPQPASA!CICS1!BRKR.REQ: using the rule name: 1compName_queueEightyPercent12222761040
Would create association for the topic: 'XPQPASA!CICS1!SYSTEM.CLUSTER.TRANSMIT.QUEUE: using the rule name: 1compName_queueEightyPercent12222761041
Would create association for the topic: 'XPQPASA!CICS1!APP1: using the rule name: 1compName_queueEightyPercent12222761042
Would create association for the topic: 'XPQPASA!CICS1!APP2: using the rule name: 1compName_queueEightyPercent12222761043
Would create association for the topic: 'XPQPASA!CICS1!CICS2: using the rule name: 1compName_queueEightyPercent12222761044
Would create association for the topic: 'XPQPASA!CICS1!FROM_PROD: using the rule name: 1compName_queueEightyPercent12222761045
Would create association for the topic: 'XPQPASA!CICS1!SYSTEM.CHANNEL.INITQ: using the rule name: 1compName_queueEightyPercent12222761046
Would create association for the topic: 'XPQPASA!CICS1!SYSTEM.DEAD.LETTER.QUEUE: using the rule name: 1compName_queueEightyPercent12222761047
Would have successfully notified the Event Service that there are 8 rules to be reloaded.

 



Match a specific string in the queue names.

maketmpltassoc -n UserName -p MyPassword event MQLocalQueue 1compName_queueEightyPercent "^.*!.*!.*CICS1.*$"

The match criteria in the queue name is CICS1.

The command might return the following:

Would create association for the topic: 'XPQPASA!APP1!CICS1: using the rule name: 1compName_queueEightyPercent12222737330
Would create association for the topic: 'XPQPASA!APP2!CICS1: using the rule name: 1compName_queueEightyPercent12222737331
Would create association for the topic: 'XPQPASA!CICS2!CICS1: using the rule name: 1compName_queueEightyPercent12222737332
Would create association for the topic: 'XPQPASA!BRKR1!CICS1.RESP: using the rule name: 1compName_queueEightyPercent12222737333
Would create association for the topic: 'XPQPASA!PRODUCTS!PRODCICS1: using the rule name: 1compName_queueEightyPercent12222737334
Would have successfully notified the Event Service that there are 5 rules to be reloaded.

 



Match a specific string in the names of all nodes, queue managers, or queues.

maketmpltassoc -n UserName -p MyPassword event MQLocalQueue 1compName_queueEightyPercent ".*CICS1.*"

The command might return the following:

Would create association for the topic: 'XPQPASA!CICS1!BRKR.REQ: using the rule name: 1compName_queueEightyPercent12222788720
Would create association for the topic: 'XPQPASA!CICS1!SYSTEM.CLUSTER.TRANSMIT.QUEUE: using the rule name: 1compName_queueEightyPercent12222788721
Would create association for the topic: 'XPQPASA!APP1!CICS1: using the rule name: 1compName_queueEightyPercent12222788722
Would create association for the topic: 'XPQPASA!APP2!CICS1: using the rule name: 1compName_queueEightyPercent12222788723
Would create association for the topic: 'XPQPASA!CICS1!APP1: using the rule name: 1compName_queueEightyPercent12222788724
Would create association for the topic: 'XPQPASA!CICS1!APP2: using the rule name: 1compName_queueEightyPercent12222788725
Would create association for the topic: 'XPQPASA!CICS1!CICS2: using the rule name: 1compName_queueEightyPercent12222788726
Would create association for the topic: 'XPQPASA!CICS2!CICS1: using the rule name: 1compName_queueEightyPercent12222788727
Would create association for the topic: 'XPQPASA!CICS1!FROM_PROD: using the rule name: 1compName_queueEightyPercent12222788728
Would create association for the topic: 'XPQPASA!CICS1!SYSTEM.CHANNEL.INITQ: using the rule name: 1compName_queueEightyPercent12222788729
Would create association for the topic: 'XPQPASA!CICS1!SYSTEM.DEAD.LETTER.QUEUE: using the rule name: 1compName_queueEightyPercent122227887210
Would create association for the topic: 'XPQPASA!BRKR1!CICS1.RESP: using the rule name: 1compName_queueEightyPercent122227887211
Would create association for the topic: 'XPQPASA!PRODUCTS!PRODCICS1: using the rule name: 1compName_queueEightyPercent122227887212
Would have successfully notified the Event Service that there are 13 rules to be reloaded.

Was this page helpful? Yes No Submitting... Thank you

Comments