Author |
Message
|
inMo |
Posted: Tue Mar 07, 2017 6:20 am Post subject: command line for finding queues |
|
|
Master
Joined: 27 Jun 2009 Posts: 216 Location: NY
|
Hi - I'm looking to find all queues that contain a unique indicator in the Description. I've run the following command:
Code: |
DIS Q(*) WHERE(DESCR LK MQ*) |
It turns out that over time, folks placed the unique indicator in various spots in the description. Is there a way to locate an indicator anywhere in the description vs. at the beginning?
Thanks. |
|
Back to top |
|
|
bruce2359 |
Posted: Tue Mar 07, 2017 10:45 am Post subject: |
|
|
Poobah
Joined: 05 Jan 2008 Posts: 9442 Location: US: west coast, almost. Otherwise, enroute.
|
If WHERE isn't granular enough, then pass DIS QL(*) DESCR output to A shell script _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
|
mqjeff |
Posted: Tue Mar 07, 2017 12:22 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Write a script using dmpmqcfg.
Parse the DESC fields of all queues, to pull out the unique id.
Run an ALTER on all the queues, putting the id at the front of the DESC .
Put a gate in place that doesn't let people put the ID anywhere else... _________________ chmod -R ugo-wx / |
|
Back to top |
|
|
PaulClarke |
Posted: Wed Mar 08, 2017 12:58 am Post subject: |
|
|
Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
Alternatively you could use MQSCX (http://www.mqgem.com/mqscx.html)
This would allow either of the following.....
Code: |
dis q(*) =find(mytext) |
or being more specific
Code: |
dis q(*) =where(desc == '*mytext*') |
plus other programmatic mechanisms if you wanted to get really clever.
Cheers,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
|
gbaddeley |
Posted: Wed Mar 08, 2017 3:16 pm Post subject: |
|
|
Jedi Knight
Joined: 25 Mar 2003 Posts: 2527 Location: Melbourne, Australia
|
If you are on UNIX, here is some shell script code to parse the multi-line output of DIS Q into single lines, and grep for contents of description. Feel free to hack / improve. Not as nice or easy as MQSCX.
Code: |
#!/usr/bin/ksh
QMGRNAME="MYQMGRNAME"
QNAMESPEC="MYQUEUES.*"
QLISTFILE="qlist.out"
DESCPATTERN="FOOBAR"
echo "dis q('$QNAMESPEC') descr" | runmqsc $QMGRNAME | awk 'function getv(j) { return(substr($0,j,index(substr($0,j),")")-1)) }
BEGIN { qn=desc="?" }
{ i=index($0,"QUEUE(") ; if(i>0) qn=getv(i+6)
i=index($0,"DESCR(") ; if(i>0) desc=getv(i+6)
if($1~/^A/ && qn!="?") {
print "name=" qn ",desc=" desc
qn=desc="?"
}
}' >$QLISTFILE
grep ,desc=.*$DESCPATTERN $QLISTFILE |
_________________ Glenn |
|
Back to top |
|
|
PaulClarke |
Posted: Wed Mar 08, 2017 3:51 pm Post subject: |
|
|
Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
Thank you for the endorsement. I have to applaud your ingenuity for a solution. However, it always amazes me that people will go to such lengths to write a script rather than buying a tool for the job. A tool by the way, in the case of MQSCX, that costs less then a couple of hours pay. There are many problems with these types of scripts in my opinion but these are the main ones....
- They are complicated
This may seem really obvious but it is a real problem. Even this very simple problem has resulted in a script which many people would struggle to write let alone modify. As the problem description gets broader, which it often does, the solution often gets exponentially more complicated.
- Very difficult to prove correctness
When you are cobbling together lots of tools to get a result when they weren't designed for the job it can be very hard to tell whether you have it written it correctly.
- Ongoing maintenance
It is bad enough trying to maintain these types of scripts yourself but many people inherit scripts like these from colleagues who have 'moved on'. The amount of time spent trying to relearn what was intended can easily pay for a suitable tool. Add to that the cost of getting something wrong and I fail to see how buying suitable tools is hard to justify.
- Employee Satisfaction
There is no doubt there is some satisfaction to be gained by coming up with a neat thing built from things you found lying around in the basement. But it is hard work, especially when you don't have the proper tools. It is far more fun and rewarding to build much better things by having tools that make it easier. For example, suppose you thought you'd write a name validation script to ensure the integrity of your MQ estate. How many of us would even attempt such a thing using the script language you mention. However, with something like MQSCX it is not only viable but easy. Having good tools actually encourages people to go out and build things, to make things better, more robust, more secure and less error prone.
Just my two cents worth. Others may disagree, as a vendor clearly I am biased
Cheers,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
|
smdavies99 |
Posted: Wed Mar 08, 2017 11:30 pm Post subject: |
|
|
Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Paul,
Yes, your tools are great and solve all sorts of problems but for many people the process of getting the purchase of them in large orgs is just far too stressful.
1) Some companies only buy from Qualified Vendors. To get on the QVL can take 6 months
2) Some companies that are really under thumb of the bean counters don't have a Low Value Purchace Order system. See QVL above.
3) Buying these low value items on expenses and {cough, cough} passing them off can be a case for an immediate dismissal.
4) Getting any Capex approved can require approval almost at BOD level
Then getting the process repeated year after year... Arrgggghhhh my brain hurts.
I tried selling software 10-12 years ago. I had lots of people interested but almost none turned into orders for these reasons.
In the end, I got some income by billing the companies for a day's training in the product. That seemed to require less scrutiny and approvals. I gave them the softwre for free. Two days and they got the sources as well.
It worked reasonable well until the Credit Crunch hit. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
|
PaulClarke |
Posted: Wed Mar 08, 2017 11:59 pm Post subject: |
|
|
Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
You are right of course, it is always harder than it should be. Somehow straight forward logic doesn't work on these people. Luckily not all companies are under the thumb of the bean counters. It is perhaps a shame though that more don't recognise the difference between visible and invisible costs.
Cheers,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
|
gbaddeley |
Posted: Thu Mar 09, 2017 3:18 pm Post subject: |
|
|
Jedi Knight
Joined: 25 Mar 2003 Posts: 2527 Location: Melbourne, Australia
|
Quote: |
Paul: However, it always amazes me that people will go to such lengths to write a script rather than buying a tool for the job. |
Many scripts were written 10-20 years ago when MQ was first introduced into the organisation. In general they are not changed unless they break because of an MQ upgrade or OS upgrade. It is difficult to convince management of the ROI to purchase, deploy and maintain new ISV tools on hundreds of servers when what we have works adequately. _________________ Glenn |
|
Back to top |
|
|
bruce2359 |
Posted: Thu Mar 09, 2017 9:28 pm Post subject: |
|
|
Poobah
Joined: 05 Jan 2008 Posts: 9442 Location: US: west coast, almost. Otherwise, enroute.
|
I'm all in favor of licensed software, rather than home-grown. That said, if I can't attach tooling to a project, then local scripting is most likely. As always, mgt must sign off on either position as to costs and maintenance. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
|
|