Compiling C++ sample programs for iSeries

This section is aimed at the C++ programmer who wants to write programs for the OS/400 platform.

IBM ILE C++ for iSeries is a native compiler for C++ programs. In addition, IBM VisualAge for C++ for iSeries provides cross-compilers with clients running on OS/2, Windows 95, or Windows NT. The cross-compilers also generate object modules that can be bound into OS/400 programs.

The following instructions describe how to use the native compiler to create WebSphere MQ C++ applications. Users of the VisualAge cross-compilers should interpret the instructions according to their version of the product.

  1. Install the ILE C++ for iSeries compiler as directed in the Read Me first! manual that accompanies the product.
  2. Ensure that the QCXXN library is in your library list.
  3. Create the HELLO WORLD sample program:
    1. Create a module:
       CRTCPPMOD MODULE(MYLIB/IMQWRLD) +
       SRCSTMF('/QIBM/ProdData/mqm/samp/imqwrld.cpp') +
       INCDIR('/QIBM/ProdData/mqm/inc') DFTCHAR(*SIGNED) +
       TERASPACE(*YES)
      

      The source for the C++ sample programs can be found in /QIBM/ProdData/mqm/samp and the include files in /QIBM/ProdData/mqm/inc.

      Alternatively, the source can be in library SRCFILE(QCPPSRC/LIB) SRCMBR(IMQWRLD).

    2. Bind this with WebSphere MQ-supplied service programs to produce a program object:
       CRTPGM PGM(MYLIB/IMQWRLD) MODULE(MYLIB/IMQWRLD) +
       BNDSRVPGM(QMQM/IMQB23I4 QMQM/IMQS23I4)
      

      See iSeries for alternative service programs that can be used.

    3. Execute the HELLO WORLD sample program, using SYSTEM.DEFAULT.LOCAL.QUEUE:
       CALL PGM(MYLIB/IMQWRLD)
      


© IBM Corporation 2001. All Rights Reserved