Before you run the sample programs on UNIX, 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 on UNIX and Linux® systems sample files are in the directories listed
in Table 1 if the defaults were used at installation time.
Table 1. Where to find the samples for IBM MQ on UNIX and Linux systems
| Content |
Directory |
| source files |
MQ_INSTALLATION_PATH/samp |
| dead-letter queue handler source files |
MQ_INSTALLATION_PATH/samp/dlq |
| executable files |
MQ_INSTALLATION_PATH/samp/bin |
MQ_INSTALLATION_PATH represents the high-level directory in
which IBM MQ is installed.
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. To run the samples, either use the executable
versions supplied or compile the source versions as you would any other applications, using an ANSI
compiler.
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
UNIX and Linux systems,
enter:
runmqsc QManagerName <amqscos0.tst > /tmp/sampobj.out
Check the
sampobj.out file to ensure that there are no errors.
-
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.