On the IBM® MQ MQI client workstation, use the
amqsputc sample program to put a message on the queue at the server workstation.
Use the amqsgetc sample program to get the message from the queue back to the
client.
Before you begin
Complete the previous topics in this section:
- Set up a queue manager, channels, and queue.
- Open a command window.
- Set system environment variables.
About this task
Note that IBM MQ object definitions are
case-sensitive. Text entered as an MQSC command in lowercase is converted automatically to uppercase
unless you enclose it in single quotation marks. Make sure that you type the examples exactly as
shown.
Procedure
-
Start the PUT program for
QUEUE1
on QUEUE.MANAGER.1
by
entering the following command:
CALL PGM(QMQM/AMQSPUTC) PARM(QUEUE1 QUEUE.MANAGER.1)
If the command is successful, the following messages are displayed:
Sample AMQSPUT0 start target queue is QUEUE1
Tip: You might get the error,
MQRC_NOT_AUTHORIZED (
2035
). By default, channel authentication is enabled when a queue manager is created. Channel
authentication prevents privileged users accessing a queue manager as an
IBM MQ MQI client. For verifying the installation, you can either
change the MCA user ID to a non-privileged user, or disable channel authentication. To disable
channel authentication run the following MQSC command:
ALTER QMGR CHLAUTH(DISABLED)
When you finish the test, if you do not delete
the queue manager, re-enable channel authentication:
ALTER QMGR CHLAUTH(ENABLED)
-
Type some message text, then press Enter twice.
The following message is displayed:
Sample AMQSPUT0 end
Your
message is now on the queue that is on the server queue manager.
-
Start the GET program for
QUEUE1
on QUEUE.MANAGER.1
by
entering the following command:
CALL PGM(QMQM/AMQSGETC) PARM(QUEUE1 QUEUE.MANAGER.1)
The sample program starts, and your message is displayed. After a short pause
(approximately 30 seconds), the sample ends and the command prompt is displayed again.
Results
You have now successfully verified the client installation.
What to do next
- On the server, stop the queue manager by entering the following command:
ENDMQM MQMNAME(QUEUE.MANAGER.1)
- On the server, delete the queue manager by entering the following command:
DLTMQM MQMNAME(QUEUE.MANAGER.1)