Configuring MQListener in Db2 for z/OS
Before you can use MQListener, you must configure your database environment so that your applications can use messaging with database operations. You must also configure IBM® MQ for MQListener.
Before you begin
Ensure that the person who runs the installation job has required authority to create the configuration table and to bind the DBRMs.
About this task
The following sample jobs for MQListener are located in the prefix.SDSNSAMP data set.
- DSNTIJML
- A sample job for extracting library files and configuring MQListener in z/OS UNIX System Services
- DSNTEJML
- A sample job that runs scripts for configuring MQListener.
- DSNTEJSP
- A sample job for extracting library tar files in z/OS UNIX System Services when applying PTFs for MQListener.
Procedure
To configure the environment for MQListener and to develop a simple application that receives a message, inserts the message in a table, and creates a simple response message, use these steps:
- Configure MQListener to run in the Db2 environment, so that your applications can use messaging with database operations, by completing the following steps:
- In z/OS UNIX System Services, the default path for MQListener in is /usr/lpp/db2d10/mql. The mqlsn.tar.Z tar file for MQListener is located in this path. If MQListener is not installed in the default path, replace all occurrences of the default path in the samples DSNTEJML, DSNTEJSP and DSNTIJML with the path name where MQListener is installed before you run DSNTIJML.
- Customize and run installation job DSNTIJML. It completes the following actions:
- Extracts the necessary files and libraries to z/OS UNIX System Services under the path where MQListener is installed.
- Creates the MQListener configuration table (SYSMQL.LISTENERS) in the default database DSNDB04.
- Binds the DBRMs to the plan DB2MQLSN.
Applying PTFs:
When applying APAR PTFs for MQListener, extract the tar file and rebind the MQListener library files in z/OS UNIX System Services by running the following steps of the DSNTIJML job: COPYHFS, UNTARLN, BINDBRM. If the SYSMQL.LISTENERS table is already defined, you must skip the CREATBL step.

- Follow the instructions in the README file in the MQListener installation path to complete the configuration process.
- Configure IBM MQ for MQListener. You can run a simple MQListener application with a simple IBM MQ configuration. More complex applications might need a more complex configuration. Configure at least two kinds of IBM MQ entities: the queue manager and some local queues. Configure these entities for use in such instances as transaction management, deadletter queue, backout queue, and backout retry threshold.
- Create IBM MQ QueueManager. Define the IBM MQ subsystem to z/OS and then issue the following command from a z/OS console to start the queue manager, where command-prefix is the command prefix for the IBM MQ subsystem.
command-prefix START QMGR - Create Queues under IBM MQ QueueManager: For example, n a simple MQListener application, you typically use the following IBM MQ queues:
- Deadletter queue
- The deadletter queue in IBM MQ holds messages that cannot be processed. MQListener uses this queue to hold replies that cannot be delivered, for example, because the queue to which the replies should be sent is full. A deadletter queue is useful in any MQ installation especially for recovering messages that are not sent.
- Backout queue
- For MQListener tasks that use two-phase commit, the backout queue serves a similar purpose as the deadletter queue. MQListener places the original request in the backout queue after the request is rolled back a specified number of times (called the backout threshold).
- Administration queue
- The administration queue is used for routing control messages, such as shutdown and restart, to MQListener. If you do not supply an administration queue, the only way to shut down MQListener is to issue a kill command.
- Application input and output queues
- The application uses input queues and output queues. The application receives messages from the input queue and sends replies and exceptions to the output queue.
Create your local queues by using CSQUTIL utility or by using IBM MQ operations and control panels from ISPF (csqorexx). The following is an example of the JCL that is used to create your local queues. In this example, MQND is the name of the queue manager://* //* ADMIN_Q : Admin queue //* BACKOUT_Q : Backout queue //* IN_Q : Input queue having a backout queue with threshold=3 //* REPLY_Q : output queue or reply queue //* DEADLLETTER_Q: Dead letter queue //* //DSNTECU EXEC PGM=CSQUTIL,PARM='MQND' //STEPLIB DD DSN=MQS.SCSQANLE,DISP=SHR // DD DSN=MQS.SCSQAUTH,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSIN DD * COMMAND DDNAME(CREATEQ) /* //CREATEQ DD * DEFINE QLOCAL('ADMIN_Q') REPLACE + DESCR('INPUT-OUTPUT') + PUT(ENABLED) + DEFPRTY(0) + DEFPSIST(NO) + SHARE + DEFSOPT(SHARED) + GET(ENABLED) DEFINE QLOCAL('BACKOUT_Q') REPLACE + DESCR('INPUT-OUTPUT') + PUT(ENABLED) + DEFPRTY(0) + DEFPSIST(NO) + SHARE + DEFSOPT(SHARED) + GET(ENABLED) DEFINE QLOCAL('REPLY_Q') REPLACE + DESCR('INPUT-OUTPUT') + PUT(ENABLED) + DEFPRTY(0) + DEFPSIST(NO) + SHARE + DEFSOPT(SHARED) + GET(ENABLED) DEFINE QLOCAL('IN_Q') REPLACE + DESCR('INPUT-OUTPUT') + PUT(ENABLED) + DEFPRTY(0) + DEFPSIST(NO) + SHARE + DEFSOPT(SHARED) + GET(ENABLED) + BOQNAME('BACKOUT_Q') + BOTHRESH(3) DEFINE QLOCAL('DEADLETTER_Q') REPLACE + DESCR('INPUT-OUTPUT') + PUT(ENABLED) + DEFPRTY(0) + DEFPSIST(NO) + SHARE + DEFSOPT(SHARED) + GET(ENABLED) ALTER QMGR DEADQ ('DEADLETTER_Q') REPLACE /*
- Create IBM MQ QueueManager. Define the IBM MQ subsystem to z/OS and then issue the following command from a z/OS console to start the queue manager, where command-prefix is the command prefix for the IBM MQ subsystem.
- Configure MQListener tasks. For more information, see Configuring MQListener tasks.
- Create a stored procedure that MQListener uses to store messages in a table. See Creating a sample stored procedure to use with MQListener for details.
- Run a simple MQListener application.