[IBM i]

Preparing C programs in IBM i

IBM® MQ for IBM i supports messages up to 100 MB in size. Application programs written in ILE C, supporting IBM MQ messages greater than 16 MB, need to use the Teraspace compiler option to allocate sufficient memory for these messages.

For more information about the C compiler options, see the WebSphere® Development Studio ILE C/C++ Programmer's Guide.

To compile a C module, you can use the IBM i command CRTCMOD. Make sure that the library containing the include files (QMQM) is in the library list when you compile.

You must then bind the output of the compiler with the service program using the CRTPGM command.
Table 1. Example of CRTPGM in non-threaded and threaded environments
Type of environment Command Program/exit type
Non-threaded environment
CRTPGM PGM( pgmname ) MODULE( pgmname )
BNDSRVPGM(QMQM/LIBMQM)
Server or client for C
Threaded environment
CRTPGM PGM( pgmname ) MODULE( pgmname )
BNDSRVPGM(QMQM/LIBMQM_R)
Server or client for C
where pgmname is the name of your program.
Table 2 lists the libraries that are needed when preparing C programs on IBM i in a non-threaded environment and threaded environment.
Table 2. Libraries needed for non-threaded and threaded environments
Type of environment Library file Program/exit type
Non-threaded environment LIBMQM Server for C
LIBMQIC & LIBMQM Client for C
Threaded environment LIBMQM_R Server for C
LIBMQIC_R & LIBMQM_R Client for C