Preparing C programs in Windows

Work in your typical Windows environment; IBM MQ for Windows requires nothing special.

For further information about programming 64-bit applications see Coding standards on 64-bit platforms.

  • Link your programs with the appropriate libraries provided by IBM MQ:
    Library file Program/exit type
    MQ_INSTALLATION_PATH \Tools\Lib\mqm.lib server for 32-bit C
    MQ_INSTALLATION_PATH \Tools\Lib\mqic.lib client for 32-bit C
    MQ_INSTALLATION_PATH \Tools\Lib\mqicxa.lib client for 32-bit C with transaction co-ordination
    MQ_INSTALLATION_PATH \Tools\Lib64\mqm.lib server for 64-bit C
    MQ_INSTALLATION_PATH \Tools\Lib64\mqic.lib client for 64-bit C
    MQ_INSTALLATION_PATH \Tools\Lib64\mqicxa.lib client for 64-bit C with transaction co-ordination

    MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.

    The following command gives an example of compiling the sample program amqsget0 (using the Microsoft Visual C++ compiler).

    For 32-bit applications:
    cl -MD amqsget0.c -Feamqsget.exe MQ_INSTALLATION_PATH\Tools\Lib\mqm.lib
    
    For 64-bit applications:
    cl -MD amqsget0.c -Feamqsget.exe MQ_INSTALLATION_PATH\Tools\Lib64\mqm.lib
    
    Note:

    • If you are writing an installable service (see the Administer for further information), you need to link to the mqmzf.lib library.
    • If you are producing an application for external coordination by an XA-compliant transaction manager such as IBM TXSeries® Encina, or BEA Tuxedo, you need to link to the mqmxa.lib or mqmxa.lib library.
    • If you are writing a CICS® exit, link to the mqmcics4.lib library.
    • You must link IBM MQ libraries before any other product libraries.
  • The DLLs must be in the path (PATH) that we have specified.
  • If we use lowercase characters whenever possible, we can move from IBM MQ for Windows to IBM MQ on UNIX and Linux systems, where use of lowercase is necessary.


Preparing CICS and Transaction Server programs

Sample C source for a CICS IBM MQ transaction is provided by AMQSCIC0.CCS. You build it using the standard CICS facilities. For example, for TXSeries for Windows 2000:
  1. Set the environment variable (enter the following code on one line):
      set CICS_IBMC_FLAGS=-I MQ_INSTALLATION_PATH\Tools\C\Include;
      %CICS_IBMC_FLAGS%
    
  2. Set the USERLIB environment variable:
      set USERLIB=MQM.LIB;%USERLIB%
    
  3. Translate, compile, and link the sample program:
      cicstcl -l IBMC amqscic0.ccs
    

MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.

This is described in the Transaction Server for Windows NT Application Programming Guide ( CICS ) V4.

We can find more information about supporting CICS transactions in the Administer.