C++ sample programs
Four sample programs are supplied, to demonstrate getting and putting messages.
The sample programs are:- HELLO WORLD (imqwrld.cpp)
- SPUT (imqsput.cpp)
- SGET (imqsget.cpp)
- DPUT (imqdput.cpp)
The sample programs are located in the directories shown in Table 1.
MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.
Environment |
Directory containing source |
Directory containing built programs |
---|---|---|
AIX |
MQ_INSTALLATION_PATH/samp |
MQ_INSTALLATION_PATH/samp/bin/ia |
IBM i |
/QIBM/ProdData/mqm/samp/ |
|
Linux |
MQ_INSTALLATION_PATH/samp |
None |
Windows |
MQ_INSTALLATION_PATH\tools\cplus\samples |
MQ_INSTALLATION_PATH\tools\cplus\ samples\bin\vn (see note 2 ) |
z/OS |
thlqual.SCSQCPPS |
- Programs built using the ILE C++ compiler for IBM i are in the library QMQM. The include files are in /QIBM/ProdData/mqm/inc.
- Programs built using the Microsoft Visual Studio Visual Studio are found in MQ_INSTALLATION_PATH\tools\cplus\samples\bin\vn. For further information about these compilers, see Building C++ programs on Windows.
- Sample program HELLO WORLD (imqwrld.cpp)
This C++ sample program shows how to put and get a regular datagram (C structure) using the ImqMessage class. - Sample programs SPUT (imqsput.cpp) and SGET (imqsget.cpp)
These C++ programs place messages to, and retrieve messages from, a named queue. - Sample program DPUT (imqdput.cpp)
This C++ sample program puts messages to a distribution list consisting of two queues.
Parent topic: Developing C++ applications