Running the amqsget and amqsgetc samples

These programs each take the following positional parameters:
  1. The name of the source queue (required)
  2. The name of the queue manager (optional)

    If a queue manager is not specified, amqsget connects to the default queue manager and amqsgetc connects to the queue manager identified by an environment variable or the client channel definition file.

  3. The open options (optional)
    If open options are not specified, the sample uses a value of 8193 which is the combination of these two options:
    • MQOO_INPUT_AS_Q_DEF
    • MQOO_FAIL_IF_QUIESCING
  4. The close options (optional)

    If close options are not specified, the sample uses a value of 0 which is MQCO_NONE.

These programs also use an environment variable named MQSAMP_USER_ID which should be set to the user ID to be used for connection authentication. When this is set, the program will prompt for a password to accompany that user ID.

To run these programs, enter one of the following:
  • amqsget myqueue qmanagername
  • amqsgetc myqueue qmanagername
where myqueue is the name of the queue from which the program will get messages, and qmanagername is the queue manager that owns myqueue.

Using amqsget and amqsgetc

Note that amqsget performs a local connection to the queue manager, using shared memory to attach to the queue manager, and as such can only be run on the system the queue manager resides, whereas amqsgetc performs a client style connection (even if connecting to a queue manager on the same system).

When using amqsgetc you need to provide the application details of how to actually reach the queue manager, in terms of the queue manager host or IP address and queue manager listener port.

Normally this is done either using the MQSERVER environment variable or by defining connection details using a client channel definition table,which can also be provided to amqsgetc using environment variables.

An example using MQSERVER, connecting to a queue manager locally, which has a listener running on port 1414 and using the default server connection channel is:
export MQSERVER="SYSTEM.DEF.SVRCONN/TCP/ localhost(1414)"