Preparing and running C and COBOL samples on IBM i
To run the samples, either use the C executable versions, which are supplied in the library QMQM, or compile them in a similar way to any other IBM® MQ application. If you want to run COBOL samples, you might need to do some additional preparation.
Before you begin
For RPG samples, see Preparing and running the RPG sample programs for IBM i.
Before you run the C and COBOL samples on IBM i, a queue manager and queues must already exist.
About this task
The source for the IBM MQ for IBM i sample programs is provided in library QMQMSAMP as members of QCSRC, QCLSRC, QCBLLESRC, and QRPGLESRC.
You can use your own queues when you run the samples, or you can run the sample program AMQSAMP4
to create some sample queues. The source for this program is included in file QCLSRC in library
QMQMSAMP. You can compile it by using the CRTCLPGM command.
![[MQ 9.4.0 Jun 2024]](ng940.gif)
The
following sample programs have authentication capabilities: - amqsbcg0.c
- amqsfhac.c
- amqsget0.c
- amqsghac.c
- amqsmhac.c
- amqsphac.c
- amqspuba.c
- amqsput0.c
- amqssslc.c
- amqssuba.c
- Creating the amqssslc program without authentication
enabled:
CRTCMOD MODULE(MYLIB/AMQSSSLC) SRCFILE(QMQMSAMP/QCSRC) CRTPGM PGM(MYLIB/AMQSSSLC) MODULE(MYLIB/AMQSSSLC) BNDSRVPGM(QMQM/LIBMQIC) - Creating the amqssslc with authentication
enabled:
CRTCMOD MODULE(MYLIB/AMQSSSLC) DEFINE('SAMPLE_AUTH_ENABLED') SRCFILE(QMQMSAMP/QCSRC) CRTCMOD MODULE(MYLIB/AMQSAUTH) SRCFILE(QMQMSAMP/QCSRC) CRTPGM PGM(MYLIB/AMQSSSLC_AUTH) MODULE(MYLIB/AMQSSSLC MYLIB/AMQSAUTH) BNDSRVPGM(QMQM/LIBMQIC)