Start and stop a queue manager on z/OS

Use this topic as an introduction to stopping and starting a queue manager.

This section describes how to start and stop a queue manager. It contains information about the following topics:

Start and stop a queue manager is relatively straightforward. When a queue manager stops under normal conditions, its last action is to take a termination checkpoint. This checkpoint, and the logs, give the queue manager the information it needs to restart.

This section contains information about the START and STOP commands, and contains a brief overview of start-up after an abnormal termination has occurred.


Before you start IBM MQ

After you have installed IBM MQ, it is defined as a formal z/OS subsystem. This message appears during any initial program load (IPL) of z/OS:
CSQ3110I +CSQ1 CSQ3UR00 - SUBSYSTEM ssnm INITIALIZATION COMPLETE

where ssnm is the IBM MQ subsystem name.

From now on, we can start the queue manager for that subsystem from any z/OS console that has been authorized to issue system control commands ; that is, a z/OS SYS command group. We must issue the START command from the authorized console, we cannot issue it through JES or TSO.

If we are using queue sharing groups, we must start RRS first, and then Db2, before you start the queue manager.


Starting a queue manager

You start a queue manager by issuing a START QMGR command. However, we cannot successfully use the START command unless you have appropriate authority. See the Set up security on z/OS for information about IBM MQ security. Figure 1 shows examples of the START command. (Remember that we must prefix an IBM MQ command with a command prefix string (CPF).)
Figure 1. Starting the queue manager from a z/OS console. The second example specifies a system parameter module name.
+CSQ1  START QMGR

+CSQ1  START QMGR PARM(NEWLOG)

See START QMGR for information about the syntax of the START QMGR command.

We cannot run the queue manager as a batch job or start it using a z/OS command START. These methods are likely to start an address space for IBM MQ that then ends abnormally. Nor can you start a queue manager from the CSQUTIL utility program or a similar user application.

We can, however, start a queue manager from an APF-authorized program by passing a START QMGR command to the z/OS MGCRE (SVC 34) service.

If we are using queue sharing groups, the associated Db2 systems and RRS must be active when you start the queue manager.

    Start options
    When you start a queue manager, a system parameter module is loaded. We can specify the name of the system parameter module in one of two ways:

    • With the PARM parameter of the /cpf START QMGR command, for example
      /cpf START QMGR PARM(CSQ1ZPRM)
      
    • With a parameter in the startup procedure, for example, code the JCL EXEC statement as
      //MQM  EXEC PGM=CSQYASCP,PARM='ZPARM(CSQ1ZPRM)'
      

    A system parameter module provides information specified when the queue manager was customized.

    From IBM MQ Version 9.1.0, we can use the QMGRPROD option to specify the product against which the queue manager usage is to be recorded, and the AMSPROD option to specify the equivalent for AMS if that is used. See the MQSC START QMGR command for details of the permitted values.

    An example JCL EXEC statement follows:
    //MQM EXEC  PGM=CSQYASCP,PARM='QMGRPROD(MQ)'

    See z/OS MVS Product Management for more information on product usage recording.

    We can also use the ENVPARM option to substitute one or more parameters in the JCL procedure for the queue manager.

    For example, we can update your queue manager startup procedure, so that the DDname CSQINP2 is a variable. This means that we can change the CSQINP2 DDname without changing the startup procedure. This is useful for implementing changes, providing backouts for operators, and queue manager operations.

    Suppose your start-up procedure for queue manager CSQ1 looked like Figure 2.

    Figure 2. Sample start-up procedure
    //CSQ1MSTR PROC INP2=NORM
    //MQMESA  EXEC PGM=CSQYASCP
    //STEPLIB DD  DISP=SHR,DSN=thlqual.SCSQANLE
    //     DD  DISP=SHR,DSN=thlqual.SCSQAUTH
    //     DD  DISP=SHR,DSN=db2qual.SDSNLOAD
    //BSDS1  DD  DISP=SHR,DSN=myqual.BSDS01
    //BSDS2  DD  DISP=SHR,DSN=myqual.BSDS02
    //CSQP0000 DD  DISP=SHR,DSN=myqual.PSID00
    //CSQP0001 DD  DISP=SHR,DSN=myqual.PSID01
    //CSQP0002 DD  DISP=SHR,DSN=myqual.PSID02
    //CSQP0003 DD  DISP=SHR,DSN=myqual.PSID03
    //CSQINP1 DD  DISP=SHR,DSN=myqual.CSQINP(CSQ1INP1)
    //CSQINP2 DD  DISP=SHR,DSN=myqual.CSQINP(CSQ1&INP2.)
    //CSQOUT1 DD  SYSOUT=*
    //CSQOUT2 DD  SYSOUT=*
    
    If you then start your queue manager with the command:
    +CSQ1  START QMGR
    

    the CSQINP2 used is a member called CSQ1NORM.

    However, suppose we are putting a new suite of programs into production so that the next time you start queue manager CSQ1, the CSQINP2 definitions are to be taken from member CSQ1NEW. To do this, you would start the queue manager with this command:
    +CSQ1  START QMGR ENVPARM('INP2=NEW')
    

    and CSQ1NEW would be used instead of CSQ1NORM. Note: z/OS limits the KEYWORD=value specifications for symbolic parameters (as in INP2=NEW) to 255 characters.

    Starting after an abnormal termination

    IBM MQ automatically detects whether restart follows a normal shutdown or an abnormal termination.

    Starting a queue manager after it ends abnormally is different from starting it after the STOP QMGR command has been issued. After STOP QMGR, the system finishes its work in an orderly way and takes a termination checkpoint before stopping. When you restart the queue manager, it uses information from the system checkpoint and recovery log to determine the system status at shutdown.

    However, if the queue manager ends abnormally, it terminates without being able to finish its work or take a termination checkpoint. When you restart a queue manager after an abend, it refreshes its knowledge of its status at termination using information in the log, and notifies you of the status of various tasks. Normally, the restart process resolves all inconsistent states. But, in some cases, we must take specific steps to resolve inconsistencies.

    User messages on start-up

    When you start a queue manager successfully, the queue manager produces a set of startup messages.


Stopping a queue manager

Before stopping a queue manager, all IBM MQ-related write-to-operator-with-reply (WTOR) messages must receive replies, for example, getting log requests. Each command in Figure 3 terminates a running queue manager.

Figure 3. Stopping a queue manager
+CSQ1  STOP QMGR

+CSQ1  STOP QMGR MODE(QUIESCE)

+CSQ1  STOP QMGR MODE(FORCE)


+CSQ1  STOP QMGR MODE(RESTART)

The command STOP QMGR defaults to STOP QMGR MODE(QUIESCE).

In QUIESCE mode, IBM MQ does not allow any new connection threads to be created, but allows existing threads to continue; it terminates only when all threads have ended. Applications can request to be notified in the event of the queue manager quiescing. Therefore, use the QUIESCE mode where possible so that applications that have requested notification have the opportunity to disconnect. See What happens during termination for details.

If the queue manager does not terminate in a reasonable time in response to a STOP QMGR MODE(QUIESCE) command, use the DISPLAY CONN command to determine whether any connection threads exist, and take the necessary steps to terminate the associated applications. If there are no threads, issue a STOP QMGR MODE(FORCE) command.

The STOP QMGR MODE(QUIESCE) and STOP QMGR MODE(FORCE) commands deregister IBM MQ from the MVS Automatic Restart Manager (ARM), preventing ARM from restarting the queue manager automatically. The STOP QMGR MODE(RESTART) command works in the same way as the STOP QMGR MODE(FORCE) command, except that it does not deregister IBM MQ from ARM. This means that the queue manager is eligible for immediate automatic restart.

If the IBM MQ subsystem is not registered with ARM, the STOP QMGR MODE(RESTART) command is rejected and the following message is sent to the z/OS console:
CSQY205I ARM element arm-element is not registered

If this message is not issued, the queue manager is restarted automatically. For more information about ARM, see Use the z/OS Automatic Restart Manager (ARM).

Only cancel the queue manager address space if STOP QMGR MODE(FORCE) does not terminate the queue manager.

If a queue manager is stopped by either canceling the address space or by using the command STOP QMGR MODE(FORCE), consistency is maintained with connected CICS or IMS systems. Resynchronization of resources is started when a queue manager restarts and is completed when the connection to the CICS or IMS system is established.

Note: When you stop your queue manager, you might find message IEF352I is issued. z/OS issues this message if it detects that failing to mark the address space as unusable would lead to an integrity exposure. We can ignore this message.

    Stop messages
    After issuing a STOP QMGR command, you get the messages CSQY009I and CSQY002I, for example:
    CSQY009I +CSQ1 ' STOP QMGR' COMMAND ACCEPTED FROM
    USER(userid), STOP MODE(FORCE)
    CSQY002I +CSQ1 QUEUE MANAGER STOPPING
    

    Where userid is the user ID that issued the STOP QMGR command, and the MODE parameter depends on that specified in the command.

    When the STOP command has completed successfully, the following messages are displayed on the z/OS console:
    CSQ9022I +CSQ1 CSQYASCP ' STOP QMGR' NORMAL COMPLETION
    CSQ3104I +CSQ1 CSQ3EC0X - TERMINATION COMPLETE
    
    If we are using ARM, and you did not specify MODE(RESTART), the following message is also displayed:
    CSQY204I +CSQ1 ARM DEREGISTER for element arm-element type
    arm-element-type successful
    
    We cannot restart the queue manager until the following message has been displayed:
    CSQ3100I +CSQ1 CSQ3EC0X - SUBSYSTEM ssnm READY FOR START COMMAND
    

Parent topic: Issuing queue manager commands on z/OS