Sample programs on IBM i
This topic describes the sample programs delivered with IBM MQ for IBM i for RPG. The samples demonstrate typical uses of the Message Queue Interface (MQI).
The samples are not intended to demonstrate general programming techniques, so some error checking that you may want to include in a production program has been omitted. However, these samples are suitable for use as a base for the own message queuing programs.
The source code for all the samples is provided with the product; this source includes comments that explain the message queuing techniques demonstrated in the programs.
There is one set of ILE sample programs:- Programs using prototyped calls to the MQI (static bound calls)
The source exists in QMQMSAMP/QRPGLESRC. The members are named AMQ3xxx4, where xxx indicates the sample function. Copy members exist in QMQM/QRPGLESRC. Each member name has a suffix of G or H.
Table 1 gives a complete list of the sample programs delivered with IBM MQ for IBM i, and shows the names of the programs in each of the supported programming languages. Notice that their names all start with the prefix AMQ, the fourth character in the name indicates the programming language.
RPG (ILE) | |
---|---|
Put samples | AMQ3PUT4 |
Browse samples | AMQ3GBR4 |
Get samples | AMQ3GET4 |
Request samples | AMQ3REQ4 |
Echo samples | AMQ3ECH4 |
Inquire samples | AMQ3INQ4 |
Set samples | AMQ3SET4 |
Trigger Monitor sample | AMQ3TRG4 |
Trigger Server sample | AMQ3SRV4 |
In addition to these, the IBM MQ for IBM i sample option includes a sample data file, AMQSDATA, which can be used as input to certain sample programs and sample CL programs that demonstrate administration tasks. The CL samples are described in Administer IBM i . You could use the sample CL program to create queues to use with the sample programs described in this topic.
For information about how to run the sample programs, see Preparing and running the sample programs on IBM i.
- Features demonstrated in the sample programs on IBM i
A table that shows the techniques demonstrated by the IBM MQ for IBM i sample programs. - Preparing and running the sample programs on IBM i
Before we can run the IBM MQ for IBM i sample programs, we must compile them as you would any other IBM MQ for IBM i applications. To do so, we can use the IBM i commands CRTRPGMOD and CRTPGM. - The Put sample program on IBM i
The Put sample program, AMQ3PUT4, puts messages on a queue using the MQPUT call. - The Browse sample program on IBM i
The Browse sample program, AMQ3GBR4, browses messages on a queue using the MQGET call. - The Get sample program on IBM i
The Get sample program, AMQ3GET4, gets messages from a queue using the MQGET call. - The Request sample program on IBM i
The Request sample program, AMQ3REQ4, demonstrates client/server processing. The sample is the client that puts request messages on a queue that is processed by a server program. It waits for the server program to put a reply message on a reply-to queue. - The Echo sample program on IBM i
The Echo sample programs return the message send to a reply queue. The program is named AMQ3ECH4 - The Inquire sample program on IBM i
The Inquire sample program, AMQ3INQ4, inquires about some of the attributes of a queue using the MQINQ call. - The Set sample program on IBM i
The Set sample program, AMQ3SET4, inhibits put operations on a queue by using the MQSET call to change the queue's InhibitPut attribute. - The Triggering sample programs on IBM i
IBM MQ for IBM i supplies two Triggering sample programs that are written in ILE/RPG. - Running the samples using remote queues on IBM i
We can demonstrate remote queuing by running the samples on connected message queue managers.
Parent topic: Applications