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 the MQSERVER 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.

Use the following environment variables to supply credentials that are used to authenticate with the queue manager:
MQSAMP_USER_ID
Set to the user ID to be used for connection authentication, if you want use a user ID and a password to authenticate with the queue manager. The program prompts for the password to accompany the user ID.
[AIX][MQ 9.3.4 Oct 2023][Linux]MQSAMP_TOKEN
Set to a non-blank value if you want to supply an authentication token to authenticate with the queue manager. The program prompts for the authentication token. Authentication tokens can be used only by the amqsgetc sample that uses client bindings.
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; for example, see MQCCDTURL.

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)"