+

Search Tips | Advanced Search

Preparing and running sample programs on Windows

Before you run the sample programs on Windows, we must first create a queue manager and also create the queues that we need. To run COBOL samples, you might need to do some additional preparation.


About this task

The IBM MQ for Windows sample files are in the directories listed in Table 1, if the defaults were used at installation time. The installation drive defaults to <c:>.

Content Directory
C source code MQ_INSTALLATION_PATH\Tools\C\Samples
Source code for dead-letter handler sample MQ_INSTALLATION_PATH\Tools\C\Samples\DLQ
COBOL source code MQ_INSTALLATION_PATH\Tools\Cobol\Samples
C executable files 1 MQ_INSTALLATION_PATH\ Tools\C\Samples\Bin (32-bit versions) MQ_INSTALLATION_PATH\ Tools\C\Samples\Bin64 (64-bit versions)
Sample MQSC files MQ_INSTALLATION_PATH\Tools\MQSC\Samples
Visual Basic source code MQ_INSTALLATION_PATH\Tools\VB\SampVB6
.NET samples MQ_INSTALLATION_PATH\Tools\dotnet\Samples

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

Note: 64-bit versions are available of some C executable file samples.

The samples need a set of queues to work with. We can either use your own queues or run the sample MQSC file amqscos0.tst to create a set of queues. To run the samples, either use the executable versions supplied or compile the source versions as you would any other IBM MQ for Windows applications.


Procedure

  1. Create a queue manager and set up the default definitions. We must do this before we can run any of the sample programs. For more information about creating a queue manager, see Administer IBM MQ. For information about configuring a queue manager to securely accept incoming connection requests from applications that are running in client mode, see Configure a queue manager to accept client connections on Windows, UNIX and IBM i.
  2. If we are not using your own queues, run the sample MQSC file amqscos0.tst to create a set of queues. To do this on Windows systems enter:
    runmqsc QManagerName < amqscos0.tst > sampobj.out

    Check the sampobj.out file to ensure that there are no errors. This file is in your current directory.

    Note:
  3. To use the COBOL versions of the Inquire, Set, and Echo examples, change the process definitions before you run these samples. For the Inquire, Set, and Echo examples, the sample definitions trigger the C versions of these samples. If we want the COBOL versions, we must change the process definitions:

    • SYSTEM.SAMPLE.INQPROCESS
    • SYSTEM.SAMPLE.SETPROCESS
    • SYSTEM.SAMPLE.ECHOPROCESS

    On Windows, do this by editing the amqscos0.tst file and changing the C executable file names to the COBOL executable file names before using the runmqsc command to run these samples.

  4. Run the sample programs. To run a sample, enter its name followed by any parameters, for example:
    amqsput myqueue qmanagername

    where myqueue is the name of the queue on which the messages are going to be put, and qmanagername is the queue manager that owns myqueue.

    For more information on the parameters that each of the samples expects, see the descriptions of the individual samples.Note: For the COBOL sample programs, when you pass queue names as parameters, we must provide 48 characters, padding with blank characters if necessary. Anything other than 48 characters causes the program to fail with reason code 2085.

Parent topic: Preparing and running the sample programs


Related reference

Last updated: 2020-10-04