You might want to save definitions of queue manager objects in a file for different reasons. For example, you may want to take a regular back-up of queue manager definitions or recreate a queue manager with identical queue manager objects. In either case, you can save definitions of queue manager objects using WMQTool. These definitions are executable with WebSphere MQ's 'runmqsc' control command.
Click on Tools/Queue Manager Definitions/Save Definitions.
You will see a window containing a list of all queue managers you have defined in the queue manager tree as follows.
Select the queue manager/s you want to save definitions of, by checking the check box in front of them. You may want to optionally exclude the definitions of Queue Manager Definition, System Objects, Queue Definitions, Channel Definitions, Process Definitions or Namelist Definitions. Check mark whatever you want to exclude and WMQTool will NOT include those definitions.
You may want to save definitions of certain objects only of a particular queue manager. Check mark against only one queue manager. The command button 'Select Objects & Save Definitions' and the text field for 'Replace queue manager name with' are activated.
Click on 'Select Objects & Save Definitions' button and you will see the following window.
Note that System Objects are not displayed as it was marked in the previous window. Check mark the objects you want to save definitions of. When you are done, click on 'Save Definitions of this Queue Manager' button. The selected objects' definitions will be saved.
You may see following message if you have not entered any value for 'Path for output files' on the previous window.
Select an existing folder where you want WMQTool to store definition files by clicking on 'Browse' button or typing in 'Path for output files' field. Remember, here you are NOT supposed to type a file name to save definitions, but you are supposed to provide the path to store the definitions files.
If you do not select any object, WMQTool will display a message like follows.
WMQTool will create separate files for each queue manager with the name <queue_manager>.def in the folder you specified. For example, for queue manager QM1, WMQTool will create a file named 'QM1.def' in the specified folder.
For more than one queue manager, click on 'Save' button to save definitions on the first window itself. WMQTool will start connecting each queue manager you selected and then will write down definitions of each queue manager in a separate file. Once WMQTool finishes saving all the definitions, it will display following message.
The def file created will contain info like following.
When WMQTool finishes writing definitions, if it could not connect to any queue manager, it will display a message like following with list of all the failed queue managers.
You may want to execute the saved definitions. These definitions can be executed using WebSphere MQ's control command 'runmqsc' or by selecting the option 'Tools/Execute Definitions' in WMQTool.
To execute the save definitions on a queue manager, you may want to provide the file as input to 'runmqsc' command on the MQ Server as follows.
For example, to run QM1.def file to run with LOCALQM, you might want to type as follows in a command window.
runmqsc < QM1.def
This will execute all the definitions contained in the file QM1.def. The result will be instantly displayed in the command window.
Using WMQTool, you can select 'Tools/Queue Manager Definitions/Execute Definitions' as follows.
It will display a window as follows.
Select the definition file you want to execute. You may want to make necessary changes in the definition file using any text editor before executing the file. This may be required when you have saved definition of a queue manager to execute on a different queue manager. In that case, you may have to change the queue manager's name, channels names etc for the queue manager executing upon.
Then select the queue manager on which you want to execute the definition file, from the drop down.
After you select definition file and queue manager, 'Execute the definitions' button will be activated. Click on that button to execute all the definitions contained in the provided file.
Click on the button 'Execute the definitions' to execute the selected definition file on the selected queue manager.
A successful message like above will be displayed when WMQTool finishes the execution of all the commands in the file. Once you click on 'Ok' button of the message, you will be able to view all the commands and their responses in the window by scrolling up and down. Look for any error messages, if any. Click on 'Close' button when you are done. Connect the queue manager on which you executed the definition file and verify that the effects of all the commands are there.