Author |
Message
|
vsathyan |
Posted: Sun Jan 04, 2015 10:10 pm Post subject: Verify MQSC commands using PCFs |
|
|
Centurion
Joined: 10 Mar 2014 Posts: 121
|
Hi dear all,
Is there an equivalent of the below example to verify the commands by sending it to the command server?
runmqsc -v QMGRNAME < MQSC_SCRIPT.TXT > MQSC_SCRIPT_VERIFY.TXT
Say, if I have 10 mqsc commands in the MQSC_SCRIPT.TXT, is there a way i can verify the syntax of it remotely?
I know that we can send this to the command server, and if it fails it returns MQRCCF_COMMAND_FAILED and that indicates there is a problem with the syntax. However, if the command is correct, it will be executed and I dont want this to happen.
If the command is correct, the command server should verify it and send the reponse back, say returning 0 (stating the command does not have any syntax error and is good for executing), without executing the command itself.
Any lights on this? Thanks in advance. |
|
Back to top |
|
 |
hughson |
Posted: Mon Jan 05, 2015 3:34 am Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
I know of no way to tell the command server itself to verify the command but not to execute it.
You could create a test queue manager and use that to verify your commands. Of course, runmqsc -v and this alternate qmgr method will not catch all errors, as some runtime errors will be dependent on exactly the state of the queue manager at the time the command is run.
Your title mentions PCF, but your question text does not. Was there a PCF element to your question?
Cheers
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jan 05, 2015 5:56 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It's not perfect, but SupportPac MS0S does a reasonable job of verifying the syntax of MQSC commands. It won't validate the values of parameters, but it will give you reasonable confidence that the structure of the command is correct.
And you can then execute the command against any queue manager known to the MQExplorer hosting MS0S. |
|
Back to top |
|
 |
vsathyan |
Posted: Mon Jan 05, 2015 11:01 am Post subject: |
|
|
Centurion
Joined: 10 Mar 2014 Posts: 121
|
Hi Morag,
Thanks for the response and sorry for not being clear.
Let me rephrase my question.
I have a MQSC file with the following contents.
DEFINE QL(TEST.LOCAL) MAXDEPTH(100)
DEFINE QL(TEST.LOCAL2) MAXDEPT(100)
If I verify the above MQSC script with runmqsc -v option, it will point out that 1 command has a syntax error (because of MAXDEPT in the second command).
When I mentioned PCFs, lets say I have a PCF admin message formatted using MQET_ESCAPE, and pass the above commands one by one using the PCF message class and send to the command server of any queue manager, it will execute the commands with correct syntax (first command in the example above), where was the command with errors will fail with MQRCCF_COMMAND_FAILED reason code (second command in the above example).
My question was - is there a way to verify the first command by sending it to a command server of a queue manager using PCF admin message instead of executing it in the queue manager.
Does this clear your doubt on how my question it is related to PCFs?
Thanks in advance. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jan 05, 2015 11:10 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
hughson wrote: |
I know of no way to tell the command server itself to verify the command but not to execute it. |
This is pretty definitive. |
|
Back to top |
|
 |
bruce2359 |
Posted: Mon Jan 05, 2015 11:20 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.ref.adm.doc/q083460_.htm describes the runmqsc command.
You can start the runmqsc command in three ways:
Quote: |
Verify command
Verify MQSC commands but do not run them. An output report is generated indicating the success or failure of each command. This mode is available on a local queue manager only.
Run command directly
Send MQSC commands directly to a local queue manager.
Run command indirectly
Run MQSC commands on a remote queue manager. These commands are put on the command queue of a remote queue manager and run in the order in which they were queued. Reports from the commands are returned to the local queue manager. |
You are using the equivalent of Run command indirectly.
The -v switch functionality is only available when you connect locally to the qmgr:
Quote: |
-v
Verifies the specified commands without performing the actions. This mode is only available locally. The -w and -x parameters are ignored if they are specified at the same time as -v. |
V8 offers the -c switch, which might satisfy your requirement:
Quote: |
-c
Modifies the runmqsc command to connect to a queue manager by using a client connection. The client channel definitions used to connect to the queue manager are located using the following environment variables in this order of precedence: MQSERVER, MQCHLLIB, and MQCHLTAB.
This option requires the client to be installed. If it is not installed an error message reporting the missing client libraries is issued. |
_________________ 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: Mon Jan 05, 2015 11:52 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Again, using the -c command does not validate the syntax.
You could use the -v command against a locally installed queue manager...
hughson wrote: |
You could create a test queue manager and use that to verify your commands. Of course, runmqsc -v and this alternate qmgr method will not catch all errors, as some runtime errors will be dependent on exactly the state of the queue manager at the time the command is run. |
I do not know of any fully supported IBM tools that will validate MQSC syntax other than runmqsc -v, which *must* talk to a local queue manager.
For things that do not require a local queue manager, MS0S is the closest you can come to an IBM supplied tool, albeit not supported by IBM directly.
Fundamentally, what Morag's statement about the lack of ability of the command server to validate but not execute a PCF message means is that no tool that does not have it's own MQSC parser will be able to validate an MQSC command. Runmqsc obviously has it's own MQSC parser, but it won't validate MQSC without being connected to a queue manager.
You *can* specify both the -v and the -c option on v8's runmqsc. However, it *does not* validate the command if it's successful. It will execute it. |
|
Back to top |
|
 |
vsathyan |
Posted: Mon Jan 05, 2015 12:03 pm Post subject: |
|
|
Centurion
Joined: 10 Mar 2014 Posts: 121
|
|
Back to top |
|
 |
hughson |
Posted: Tue Jan 06, 2015 1:37 am Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
vsathyan wrote: |
My question was - is there a way to verify the first command by sending it to a command server of a queue manager using PCF admin message instead of executing it in the queue manager.
Does this clear your doubt on how my question it is related to PCFs?
Thanks in advance. |
That is clear. In this case, I think the best way to test out your PCF messages is the idea of a test queue manager.
Cheers
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jan 06, 2015 5:30 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
hughson wrote: |
vsathyan wrote: |
My question was - is there a way to verify the first command by sending it to a command server of a queue manager using PCF admin message instead of executing it in the queue manager.
Does this clear your doubt on how my question it is related to PCFs?
Thanks in advance. |
That is clear. In this case, I think the best way to test out your PCF messages is the idea of a test queue manager.
Cheers
Morag |
You know, Morag... enabling the -v flag on runmqsc without any other dependency than the MQSC in question would make runmqsc a very handy tool for lots of people to use to add MQSC capabilites to their tools.
Without having to write, and worse maintain, an MQSC parser of their own...
 |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jan 06, 2015 6:42 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
mqjeff wrote: |
You know, Morag... enabling the -v flag on runmqsc without any other dependency than the MQSC in question would make runmqsc a very handy tool for lots of people to use to add MQSC capabilites to their tools.
Without having to write, and worse maintain, an MQSC parser of their own...
 |
Which part of the OP wanting to use that capability (check only do not implement) with PCF messages only did you miss? We are not talking about runmqsc...
Although I completely second your observation...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jan 06, 2015 6:48 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
fjb_saper wrote: |
Which part of the OP wanting to use that capability (check only do not implement) with PCF messages only did you miss? We are not talking about runmqsc... |
No part...
But it's a bit hard to say what kind of PCF message can be valid, structurally, but represents incorrect syntax. The command server does already verify that the structure and content and values of the messages are correct.
I mean, there are things like "I want to alter an object that doesn't exist". But again, the command server will return an error in that case.
I suppose you could, in theory, want to send "I want to alter an object", and only receive back "Yes, the object does exist, but it has not been altered".
But that's not validating the syntax...
fjb_saper wrote: |
Although I completely second your observation...  |
Good, go open an RFE...  |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Jan 06, 2015 6:57 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Does the OP want to verify the syntax of the mq script commands only? Or the PCF wrapping only? Or both?
I generally encourage direct connection to qmgrs for admin, and discourage use of the SYSTEM.COMMAND.INPUT queue and command server given the security exposure if inbound channels are not secured. _________________ 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 |
|
 |
fjb_saper |
Posted: Tue Jan 06, 2015 7:05 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I believe what the OP was really after was:
Create a "bunch" of pcf command messages (with mode check only)
send them to the command server
get notified of which have a problem
Not get notified when a message fails but apply the preceding/following ones...
The problem here being that mode check only does not exist for pcf messages AFAIK  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|