Design of the Put Reference Message sample (amqsprma.c, AMQSPRM4)

This topic gives a detailed description of a Put Reference Message sample.

This sample creates a Reference Message that refers to a file and puts it on a specified queue:
  1. The sample connects to a local queue manager using MQCONN.
  2. It then opens (MQOPEN) a model queue that is used to receive report messages.
  3. The sample builds a Reference Message containing the values required to move the file, for example, the source and destination file names and the object type. As an example, the sample shipped with IBM MQ builds a Reference Message to send the file d:\x\file.in from QMGR1 to QMGR2 and to re-create the file as d:\y\file.out using the following parameters:
    amqsprm -q QR -m QMGR1 -i d:\x\file.in -o d:\y\file.out -t FLATFILE
    
    Where QR is a remote queue definition that refers to a target queue on QMGR2. Note: For UNIX and Linux platforms, use two backslashes (\\) instead of one to denote the destination file directory. Therefore, the amqsprm command looks like this:
    amqsprm -q QR -m QMGR1 -i /x/file.in -o d:\\y\\file.out -t FLATFILE
    
  4. The Reference Message is put (without any file data) to the queue specified by the /q parameter. If this is a remote queue, the message is put to the corresponding transmission queue.
  5. The sample waits, for the duration of time specified in the /w parameter (which defaults to 15 seconds), for COA reports, which, along with exception reports, are sent back to the dynamic queue created on the local queue manager (QMGR1).

Parent topic: The Reference Message sample programs