Running the sample programs

Consider using this topic when running sample programs across different platforms.

Before you can run any of the sample programs, create a queue manager and set up the default definitions. This is explained in Administering.

On Windows, UNIX and Linux platforms

The samples need a set of queues to work with. Either use your own queues or run the sample MQSC file amqscos0.tst to create a set.

To do this on UNIX and Linux® systems, enter:
  • runmqsc QManagerName <amqscos0.tst >/tmp/sampobj.out
Check the sampobj.out file to ensure that there are no errors.
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.
You can now run the sample applications. Enter the name of the sample application 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.

See the description of the individual samples for information on the parameters that each of them expects.

[IBMi]

On IBM i

You can use your own queues when you run the samples, or you can run the sample program AMQSAMP4 to create some sample queues. The source for this program is shipped in file QCLSRC in library QMQMSAMP. It can be compiled using the CRTCLPGM command.

To call one of the sample programs using data from member PUT in file AMQSDATA of library QMQMSAMP, use a command like:

CALL PGM(QMQM/AMQSPUT4) PARM('QMQMSAMP/AMQSDATA(PUT)')
The sample data only applies to the C/400® sample programs.
Note: For a compiled module to use the IFS file system, specify the option SYSIFCOPT(*IFSIO) on CRTCMOD, then the file name, passed as a parameter, must be specified in the following format:

home/me/myfile

Length of queue name

For the COBOL sample programs, when you pass queue names as parameters, you must provide 48 characters, padding with blank characters if necessary. Anything other than 48 characters causes the program to fail with reason code 2085.

Inquire, Set, and Echo examples

For the Inquire, Set, and Echo examples, the sample definitions trigger the C versions of these samples.

If you want the COBOL versions you must change the process definitions:
  • SYSTEM.SAMPLE.INQPROCESS
  • SYSTEM.SAMPLE.SETPROCESS
  • SYSTEM.SAMPLE.ECHOPROCESS

On Windows, UNIX and Linux systems 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, as shown previously.

[IBMi]On IBM® i, you can use the CHGMQMPRC command (for details, see Change MQ Process (CHGMQMPRC) ), or edit and run the AMQSAMP4 command with the alternative definition.