Running the Request sample using triggering on IBM i
On IBM i, start the sample trigger server, AMQSERV4, in one job, then start AMQSREQ4 in another. This means that the trigger server is ready when the Request sample program sends a message.
Note:- The sample definitions created by AMQSAMP4 trigger the C versions of the samples. To trigger the COBOL versions, change the process definitions SYSTEM.SAMPLE.ECHOPROCESS, SYSTEM.SAMPLE.INQPROCESS, and SYSTEM.SAMPLE.SETPROCESS. We can use the CHGMQMPRC command (for details, see Change MQ Process (CHGMQMPRC) ) to do this, or edit and run your own version of AMQSAMP4.
- Source code for AMQSERV4 is supplied for the C language only. However, a compiled version (that we can use with the COBOL samples) is supplied in library QMQM.
You could put your request messages on these sample server queues:
- SYSTEM.SAMPLE.ECHO (for the Echo sample programs)
- SYSTEM.SAMPLE.INQ (for the Inquire sample programs)
- SYSTEM.SAMPLE.SET (for the Set sample programs)
A flow chart for the SYSTEM.SAMPLE.ECHO program is shown in Figure 1. Using the example data file the command to issue the C program request to this server is:
CALL PGM(QMQMSAMP/AMQSREQ4) PARM('QMQMSAMP/AMQSDATA(ECHO)')Note: This sample queue has a trigger type of FIRST, so if there are already messages on the queue before you run the Request sample, server applications are not triggered by the messages you send. To attempt further examples, we can try the following variations:
- Use AMQSTRG4 (or its command line equivalent STRMQMTRM, for details, see Start MQ Trigger Monitor (STRMQMTRM) ) instead of AMQSERV4 to submit the job instead, but potential job submission delays could make it less easy to follow what is happening.
- Run the SYSTEM.SAMPLE.INQUIRE and SYSTEM.SAMPLE.SET sample programs. Using the example data file the commands to issue the C program requests to these servers are, respectively:
CALL PGM(QMQMSAMP/AMQSREQ4) PARM('QMQMSAMP/AMQSDATA(INQ)') CALL PGM(QMQMSAMP/AMQSREQ4) PARM('QMQMSAMP/AMQSDATA(SET)')
These sample queues also have a trigger type of FIRST.
Parent topic: Running the Request sample using triggering