Preparing and running the RPG sample programs for IBM i
Before you begin
For C and COBOL samples, see Preparing and running C and COBOL samples on IBM i.
Before you can run the RPG sample programs, you must compile them as you would any other IBM MQ for IBM i applications. To do so, you can use the IBM i commands CRTRPGMOD and CRTPGM.
When you create the AMQ3xxx4 programs, you must specify BNDSRVPGM(QMQM/LIBMQM)
in the CRTPGM command. Doing so includes the various IBM MQ procedures in your program.
About this task
The source for the RPG sample programs is provided in library QMQMSAMP as members of QRPGLESRC. They use the copy files provided in library QMQM, so make sure that this library is in the library list when you compile them. The RPG compiler gives information messages because the samples do not use many of the variables that are declared in the copy files.
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 included in file QCLSRC in library
QMQMSAMP. You can compile it by using the CRTCLPGM command.
Example
CALL PGM(QMQMSAMP/AMQ3PUT4) PARM('Queue_Name','Queue_Manager_Name')
Where Queue_Name and Queue_Manager_Name must be 48 characters
in length, which you achieve by padding the Queue_Name and
Queue_Manager_Name with the required number of blanks.
For the Inquire and Set sample programs, the sample definitions created by AMQSAMP4 cause the C
versions of these samples to be triggered. If you want to trigger the RPG versions, you must change
the process definitions SYSTEM.SAMPLE.ECHOPROCESS and SYSTEM.SAMPLE.INQPROCESS and
SYSTEM.SAMPLE.SETPROCESS. You can use the CHGMQMPRC command (described in Change MQ Process (CHGMQMPRC) ) to do so, or
edit and run the AMQSAMP4 program with the alternative definition.