Before you run the sample programs on Windows, you must first create a queue manager and also create the queues that you need. If you want to
run COBOL samples, you might need to do some additional preparation.
About this task
The
IBM® MQ for Windows sample files are in the directories
listed in
Table 1, if the defaults were used at installation time. The
installation drive defaults to <c:>.
Table 1. Where to find the samples for IBM MQ for Windows
| Content |
Directory |
| C source code |
MQ_INSTALLATION_PATH\Tools\C\Samples |
| Source code for dead-letter handler sample |
MQ_INSTALLATION_PATH\Tools\C\Samples\DLQ |
| COBOL source code |
MQ_INSTALLATION_PATH\Tools\Cobol\Samples |
| C executable files 1 |
MQ_INSTALLATION_PATH\ Tools\C\Samples\Bin
(32-bit versions) MQ_INSTALLATION_PATH\ Tools\C\Samples\Bin64
(64-bit versions) |
| Sample MQSC files |
MQ_INSTALLATION_PATH\Tools\MQSC\Samples |
| Visual Basic source code |
MQ_INSTALLATION_PATH\Tools\VB\SampVB6 |
| .NET samples |
MQ_INSTALLATION_PATH\Tools\dotnet\Samples |
MQ_INSTALLATION_PATH represents the high-level directory in
which IBM MQ is installed.
Note: 64-bit versions are available of some C executable file samples.
The samples need a set of queues to work with. You can either use your own queues or run the
sample MQSC file amqscos0.tst to create a set of queues. To run the samples, either use the
executable versions supplied or compile the source versions as you would any other IBM MQ for Windows applications.
Procedure
-
Create a queue manager and set up the default definitions.
-
If you are not using your own queues, run the sample MQSC file amqscos0.tst to create a set of
queues.
To do this on
Windows systems
enter:
runmqsc QManagerName < amqscos0.tst > sampobj.out
Check the
sampobj.out file to ensure that there are no errors. This file is in your
current directory.
-
If you want to use the COBOL versions of the Inquire, Set, and Echo examples, change the
process definitions before you run these samples.
For the Inquire, Set, and Echo examples, the sample definitions trigger the C versions of
these samples. If you want the COBOL versions, you must change the process definitions:
- SYSTEM.SAMPLE.INQPROCESS
- SYSTEM.SAMPLE.SETPROCESS
- SYSTEM.SAMPLE.ECHOPROCESS
On Windows, do this by editing the
amqscos0.tst file and changing the C executable file names to the COBOL
executable file names before using the runmqsc command to run these samples.
-
Run the sample programs.
To run a sample, enter its name followed by any parameters, for
example:
amqsput myqueue qmanagername
where
myqueue is the name of the queue on which the messages are going
to be put, and qmanagername is the queue manager that owns
myqueue.
For more information on the parameters that each
of the samples expects, see the descriptions of the individual samples.
Note: For the COBOL sample
programs, when you pass queue names as parameters, you must provide 48 characters, padding with
blank characters if necessary. Anything other than 48 characters causes the program to fail with
reason code 2085.