+

Search Tips | Advanced Search

Configure work management examples on IBM i

Use this information to learn how we can change and create IBM MQ job descriptions to change the runtime attributes of IBM MQ jobs.

The key to the flexibility of IBM MQ work management lies in the two-tier way that IBM MQ searches for job descriptions:

  • If you create or change job descriptions in a queue manager library, those changes override the global job descriptions in QMQM, but the changes are local and affect that particular queue manager alone.
  • If you create or change global job descriptions in the QMQM library, those job descriptions affect all queue managers on the system, unless overridden locally for individual queue managers.

  1. The following example increases the priority of channel control jobs for an individual queue manager. To make the repository manager and channel initiator jobs, AMQRRMFA and RUNMQCHI, run as quickly as possible for queue manager TESTQM, carry out the following steps:
    1. Create local duplicates of the QMQM/QMQMJOBD job description with the names of the IBM MQ processes that we want to control in the queue manager library. For example:
      CRTDUPOBJ OBJ(QMQMJOBD) FROMLIB(QMQM) OBJTYPE(*JOBD) TOLIB(QMTESTQM)
      NEWOBJ(RUNMQCHI)
      CRTDUPOBJ OBJ(QMQMJOBD) FROMLIB(QMQM) OBJTYPE(*JOBD) TOLIB(QMTESTQM)
      NEWOBJ(AMQRRMFA)
      
    2. Change the routing data parameter on the job description to ensure that the jobs use the QMQMRUN20 class.
      CHGJOBD JOBD(QMTESTQM/RUNMQCHI) RTGDTA('QMQMRUN20')
      CHGJOBD JOBD(QMTESTQM/AMQRRMFA) RTGDTA('QMQMRUN20')
      

    The AMQRRMFA and RUNMQCHI jobs for queue manager TESTQM now:

    • Use the new local job descriptions in the queue manager library
    • Run with priority 20, because the QMQMRUN20 class is used when the jobs enter the subsystem.

  2. The following example defines a new run priority class for the QMQM subsystem.
    1. Create a duplicate class in the QMQM library, to allow other queue managers to access the class, by issuing the following command:
      CRTDUPOBJ OBJ(QMQMRUN20) FROMLIB(QMQM) OBJTYPE(*CLS) TOLIB(QMQM)
      NEWOBJ(QMQMRUN10)
      
    2. Change the class to have the new run priority by issuing the following command:
      CHGCLS CLS(QMQM/QMQMRUN10) RUNPTY(10)
      
    3. Add the new class definition to the subsystem by issuing the following command:
      ADDRTGE SBSD(QMQM/QMQM) SEQNBR(8999) CMPVAL('QMQMRUN10') PGM(QSYS/QCMD)
      CLS(QMQM/QMQMRUN10)
      
      Note: We can specify any numeric value for the routing sequence number, but the values must be in sequential order. This sequence number tells the subsystem the order in which routing entries are to be searched for a routing data match.
    4. Change the local or global job description to use the new priority class by issuing the following command:
      CHGJOBD JOBD(QMQMlibname/QMQMJOBD) RTGDTA('QMQMRUN10')
      

      Now all the queue manager jobs associated with the QMlibraryname use a run priority of 10.

  3. The following example runs a queue manager in its own subsystem To make all the jobs for queue manager TESTQM run in the QBATCH subsystem, carry out the following steps:
    1. Create a local duplicate of the QMQM/QMQMJOBD job description in the queue manager library with the command
      CRTDUPOBJ OBJ(QMQMJOBD) FROMLIB(QMQM) OBJTYPE(*JOBD) TOLIB(QMTESTQM)
      
    2. Change the job queue parameter on the job description to ensure that the jobs use the QBATCH job queue.
      CHGJOBD JOBD(QMTESTQM/QMQMJOBD) JOBQ(*LIBL/QBATCH)
      
      Note: The job queue is associated with the subsystem description. If we find that the jobs are staying on the job queue, verify that the job queue definition is defined on the SBSD. Use the DSPSBSD command for the subsystem and take option 6, Job queue entries.

    All jobs for queue manager TESTQM now:

    • Use the new local default job description in the queue manager library
    • Are submitted to job queue QBATCH.

    To ensure that jobs are routed and prioritized correctly:

    • Either create routing entries for the IBM MQ jobs in subsystem QBATCH, or
    • Rely on a catch-all routing entry that calls QCMD, irrespective of what routing data is used.

      This option works only if the maximum active jobs option for job queue QBATCH is set to *NOMAX. The system default is 1.

  4. The following example creates another IBM MQ subsystem
    1. Create a duplicate subsystem in the QMQM library by issuing the following command:
      CRTDUPOBJ OBJ(QMQM) FROMLIB(QMQM) OBJTYPE(*SBSD) TOLIB(QMQM) NEWOBJ(QMQM2)
      
    2. Remove the QMQM job queue by issuing the following command:
      RMVJOBQE SBSD(QMQM/QMQM2) JOBQ(QMQM/QMQM)
      
    3. Create a new job queue for the subsystem by issuing the following command:
      CRTJOBQ JOBQ(QMQM/QMQM2) TEXT('Job queue for IBM MQ Queue Manager')
      
    4. Add a job queue entry to the subsystem by issuing the following command:
      ADDJOBQE SBSD(QMQM/QMQM2) JOBQ(QMQM/QMQM2) MAXACT(*NOMAX)
      
    5. Create a duplicate QMQMJOBD in the queue manager library by issuing the following command:
      CRTDUPOBJ OBJ(QMQMJOBD) FROMLIB(QMQM) OBJTYPE(*JOBD) TOLIB(QMlibraryname)
      
    6. Change the job description to use the new job queue by issuing the following command:
      CHGJOBD JOBD(QMlibraryname/QMQMJOBD) JOBQ(QMQM/QMQM2)
      
    7. Start the subsystem by issuing the following command:
      STRSBS SBSD(QMQM/QMQM2)
      

    Note:

    1. We can specify the subsystem in any library. If for any reason the product is reinstalled, or the QMQM library is replaced, any changes you made are removed.
    2. All the queue manager jobs associated with the QMlibraryname now run under subsystem QMQM2.

  5. The following example collects all output for a job type. To collect all the checkpoint process, AMQALMPX, job logs for multiple queue managers onto a single output queue, carry out the following steps:
    1. Create an output queue, for example
      CRTOUTQ OUTQ(MYLIB/CHCKPTLOGS)
      
    2. Create a global duplicate of the QMQM/QMQMJOBD job description, using the name of the IBM MQ process that we want to control, for example
      CRTDUPOBJ OBJ(QMQMJOBD) FROMLIB(QMQM) OBJTYPE(*JOBD) NEWOBJ(AMQALMPX)
      
    3. Change the output queue parameter on the job description to point to your new output queue, and change the job logging level so that all messages are written to the job log.
      CHGJOBD JOBD(QMQM/AMQALMPX) OUTQ(MYLIB/CHKPTLOGS) LOG(4 00 *SECLVL)
      

    All IBM MQ AMQALMPX jobs, for all queue managers, use the new global AMQALMPX job description, provided that there are no local overriding job descriptions in the local queue manager library.

    All job log spool files for these jobs are now written to output queue CHKPTLOGS in library MYLIB.

    Note:
    1. The preceding example works only if the QPJOBLOG, or any print file, has a value of *JOB for its output queue parameter. In the preceding example, the QSYS/QPDJOBLOG file needs OUTQ set to *JOB.
    2. To change a system print file, use the CHGPRTF command. For example:
      CHGPRTF PRTF(QJOBLOG) OUTQ(*JOB)
      
      The *JOB option indicates that your job descriptions must be used.
    3. We can send any spool files associated with the IBM MQ jobs to a particular output queue. However, verify that the print file being used has the appropriate value for the OUTQ parameter.

Parent topic: Work management for IBM i

Last updated: 2020-10-04