Author |
Message
|
HenriqueS |
Posted: Thu Dec 14, 2006 1:34 pm Post subject: How to get answers from PCF commands sent to a COMMAND queue |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
Folks,
Is there a way I can get the output of a command that was sent to a COMMAND queue (SYSTEM.ADMIN.COMMAND.QUEUE) ??
Where the output, return codes and error codes from such commands sent to this queue are kept? |
|
Back to top |
|
 |
wschutz |
Posted: Thu Dec 14, 2006 2:08 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
In the replyToQueue you named when you sent the messages to the command queue.  _________________ -wayne |
|
Back to top |
|
 |
HenriqueS |
Posted: Fri Dec 15, 2006 9:10 am Post subject: |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
Thanks,
I´ve tried to make some simple tests on a command queue, but I guess I am doing something wrong.
I am jut putting a MQSC string into the command queue using the MQ Explorer ("put test message")
i.e.: DEFINE QLOCAL('TEST') REPLACE + DESCR('My test')
Obviously I see no local queue is created. So, whats wrong? Do I need to set some special fields on the message itself to make it being interpreted as a command? |
|
Back to top |
|
 |
wschutz |
Posted: Fri Dec 15, 2006 9:14 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Well....................... (unless you are sending this command to zOS queue manager), you need to format the messages as a PCF message... do a search here and you'll get lots of hits on doing just that.... _________________ -wayne |
|
Back to top |
|
 |
Nigelg |
Posted: Mon Dec 18, 2006 1:48 am Post subject: |
|
|
Grand Master
Joined: 02 Aug 2004 Posts: 1046
|
Not quite sure where to start...
The msg sent to the command server has a special MQMD format (MQFMT_ADMIN) and consists of a number of structures.
Read the Programmable Command Format manual for instructions on how to do this.
It is possible to send a runmqsc type command via PCF, but it has to be in the context of a properly formatted PCF msg.
This is not a particularly trivial subject. One of the WMQ manuals (I forget which) has the code of a sample app which sends PCF msgs and reads replies. _________________ MQSeries.net helps those who help themselves.. |
|
Back to top |
|
 |
HenriqueS |
Posted: Mon Dec 18, 2006 11:56 am Post subject: |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
Funny enough, most of MQ tutorials and overview docs give the impression the programmer can just put MQSC commands to the SYSTEM.COMMAND queue and have everything interpreted down there.
Things seems rough now...
This should be put on the MQ to-do list. I´ve browsed though the PCF documentation and seems they forgot about the KISS principle. |
|
Back to top |
|
 |
HenriqueS |
Posted: Mon Dec 18, 2006 12:35 pm Post subject: |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
Well, I found out that such functionality probably is only available on Z/OS.
Here, I am developing a small admin web app that probably will be made to work on Z/OS as well on Linux/Windows platforms.
So, I figured out a way:
a) If the app is connected to a Z/OS environment, will output the commands to the SYSTEM.COMMAND.INPUT queue using the regular MQSC syntax.
b) If the app is connected to a low platform environment, the app will output commands to MY.COMMAND.QUEUE (not the SYSTEM.ADMIN.COMMAND.QUEUE). Such "personal" command queue will be watched by a trigger that will process each incoming message and run it under the runmqsc process.
What do you guys think? |
|
Back to top |
|
 |
kevinf2349 |
Posted: Mon Dec 18, 2006 12:48 pm Post subject: |
|
|
 Grand Master
Joined: 28 Feb 2003 Posts: 1311 Location: USA
|
Quote: |
b) If the app is connected to a low platform environment, the app will output commands to MY.COMMAND.QUEUE (not the SYSTEM.ADMIN.COMMAND.QUEUE). Such "personal" command queue will be watched by a trigger that will process each incoming message and run it under the runmqsc process.
What do you guys think? |
I think it sucks. Use PCF messages. They are available on z/OS with version 6. All you are doing is delaying the inevitable....PCF is the way to go and really isn't that bad once you get familiar with it. Take the time to learn. There is more benefit in it in the long run for you and for your shop. |
|
Back to top |
|
 |
HenriqueS |
Posted: Mon Dec 18, 2006 1:06 pm Post subject: |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
The issue is that in the soon future I may be not maintaining such program, and let´s get the facts, MQSC syntax is way more maintainable.
Anyway, do you know if there is any PCF constructor/method that may accept a MQSC syntax, parse it and just fill the blanks in the PCF object instance? I.e.:
PCFCommand pcf = new PCFCommand("DEFINE QLOCAL ETC.")
??
kevinf2349 wrote: |
Quote: |
b) If the app is connected to a low platform environment, the app will output commands to MY.COMMAND.QUEUE (not the SYSTEM.ADMIN.COMMAND.QUEUE). Such "personal" command queue will be watched by a trigger that will process each incoming message and run it under the runmqsc process.
What do you guys think? |
I think it sucks. Use PCF messages. They are available on z/OS with version 6. All you are doing is delaying the inevitable....PCF is the way to go and really isn't that bad once you get familiar with it. Take the time to learn. There is more benefit in it in the long run for you and for your shop. |
|
|
Back to top |
|
 |
wschutz |
Posted: Mon Dec 18, 2006 1:55 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
HenriqueS wrote: |
Anyway, do you know if there is any PCF constructor/method that may accept a MQSC syntax, parse it and just fill the blanks in the PCF object instance? I.e.:
PCFCommand pcf = new PCFCommand("DEFINE QLOCAL ETC.")
??
|
The closest thing to something like that is ms0b: MQSeries Java classes for PCF. it includes many samples and is easy to use (imho). _________________ -wayne |
|
Back to top |
|
 |
kevinf2349 |
Posted: Mon Dec 18, 2006 1:59 pm Post subject: |
|
|
 Grand Master
Joined: 28 Feb 2003 Posts: 1311 Location: USA
|
Quote: |
The issue is that in the soon future I may be not maintaining such program, and let´s get the facts, MQSC syntax is way more maintainable.
|
MQSC commands may be in 'plain English' but PCF commands are still pretty easy too.
If I came into a shop I would almost expect code to be written to use PCF commands rather than MQSC commands.
I suspect the issue here isn't one of ease of maintaining it is one of ease of coding. As you are discovering here though it isn't as easy to use MQSC commands as you may first think.
What language are you writing this program in and I may be able to provide you with a sample PCF program? |
|
Back to top |
|
 |
HenriqueS |
Posted: Mon Dec 18, 2006 3:55 pm Post subject: |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
Thanks man, I already downloaded the PCF API for Java. I will discuss this with my boss and see what are we going to do...
Still, the samples show it is pretty verbose.
Thanks for the feedback everyone,
kevinf2349 wrote: |
Quote: |
The issue is that in the soon future I may be not maintaining such program, and let´s get the facts, MQSC syntax is way more maintainable.
|
MQSC commands may be in 'plain English' but PCF commands are still pretty easy too.
If I came into a shop I would almost expect code to be written to use PCF commands rather than MQSC commands.
I suspect the issue here isn't one of ease of maintaining it is one of ease of coding. As you are discovering here though it isn't as easy to use MQSC commands as you may first think.
What language are you writing this program in and I may be able to provide you with a sample PCF program? |
|
|
Back to top |
|
 |
Vitor |
Posted: Mon Dec 18, 2006 11:50 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kevinf2349 wrote: |
If I came into a shop I would almost expect code to be written to use PCF commands rather than MQSC commands.
|
For what it's worth, my experience is that MQSC commands are limited to scripts. All application control is from PCF exactly because it's easier to obtain responses and act on them in a coding environment.
Personal opinion - feeding MQSC commands via a trigger is reinventing a wheel, and including corners in the design. Adds another layer to the process and how would your trigger return errors to the initiating program.
But that's just me.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
EddieA |
Posted: Tue Dec 19, 2006 9:47 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
HenriqueS wrote: |
The issue is that in the soon future I may be not maintaining such program, and let´s get the facts, MQSC syntax is way more maintainable. |
Only for sending the requests in. Not for understanding the replies back. You have to parse text strings, which have chnaged between releases, for the same reply.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
|