MQSUBRQ (Subscription Request) on IBM i

The MQSUBRQ call makes a request on a subscription.


Syntax

MQSUBRQ (HCONN, HSUB, ACTION, SUBROPT, CMPCOD, REASON)


Usage notes

The following usage notes apply to the use of SRAPUB:
  1. If this verb completes successfully, the retained publications matching the subscription specified have been sent to the subscription and can be received by using MQGET or MQCB using the HOBJ returned on the original MQSUB verb that created the subscription.
  2. If the topic subscribed to by the original MQSUB verb that created the subscription contained a wildcard, more than one retained publication might be sent. The number of publications sent as a result of this call is recorded in the SRNMP field in the SBROPT structure.
  3. If this verb completes with a reason code of RC2437 then there were no currently retained publications for the topic specified.
  4. If this verb completes with a reason code of RC2525 or RC2526 then there are currently retained publications for the topic specified but an error has occurred that that meant they were unable to be delivered.
  5. The application must have a current subscription to the topic before it can make this call. If the subscription was made in a previous instance of the application and a valid handle to the subscription is not available, the application must first call MQSUB with the SORES option to obtain a handle to it for use in this call.
  6. The publications are sent to the destination that is registered for use with the current subscription of this application. If the publications should be sent somewhere else, the subscription must first be altered using the MQSUB call with the SOALT option.


Parameters

The MQSUBRQ call has the following parameters:

    HCONN (10-digit signed integer) - input

    This handle represents the connection to the queue manager. The value of HCONN was returned by a previous MQCONN or MQCONNX call.

    On z/OS for CICS applications the MQCONN call can be omitted, and the following value specified for HCONN :

      HCDEFH
      Default connection handle.

    HSUB (10-digit signed integer) - input

    This handle represents the subscription for which an update is to be requested. The value of HSUB was returned from a previous MQSUB call.

    ACTION (10-digit signed integer) - input
    This parameter controls the particular action that is being requested on the subscription. One (and only one) of the following must be specified:

      SRAPUB

      This action requests that an update publication be sent for the specified topic. This is normally used if the subscriber specified the option SOPUBR on the MQSUB call when it made the subscription. If the queue manager has a retained publication for the topic, this is sent to the subscriber. If not, the call fails. If an application is sent a publication which was retained, this is indicated by the MQIsRetained message property of that publication.

      Since the topic in the existing subscription represented by the HSUB parameter can contain wildcards, the subscriber might receive multiple retained publications.

    SBROPT (MQSRO) - input/output

    These options control the action of MQSUBRQ, see MQSRO - Subscription request options for details.

    CMPCOD (10-digit signed integer) - output
    The completion code; it is one of the following:

      CCOK
      Successful completion

      CCWARN
      Warning (partial completion)

      CCFAIL
      Call failed

    Reason (10-digit signed integer) - output

    The reason code qualifying CMPCOD.

    If CPMCOD is CCOK:

      RCNONE
      (0, X'000') No reason to report.

    If CPMCOD is CCFAIL:

      RC2298
      2298 (X'08FA') The function requested is not available in the current environment.

      RC2437
      2437 (X'0985') There are no retained publications currently stored for this topic.

      RC2046
      2046 (X'07FE') Options parameter or field contains options that are not valid, or a combination of options that is not valid.

      RC2161
      2161 (X'0871') Queue manager quiescing

      RC2438
      2438 (X'0986') On the MQSUBRQ call, the Subscription Request Options MQSRO is not valid.


RPG Declaration

     C*..1....:....2....:....3....:....4....:....5....:....6....:....7..
     C                     CALLP     MQSUBRQ(HCONN : HSUB : ACTION : 
     C                                       SBROPT : CMPCOD : REASON)
The prototype definition for the call is:
     D*..1....:....2....:....3....:....4....:....5....:....6....:....7..
     DMQSUBRQ          PR                  EXTPROC('MQSUBRQ')
     D* Connection handle
     D HCONN                         10I 0 VALUE
     D* Subscription handle
     D HSUB                          10I 0 VALUE
     D* Action requested on the subscription
     D ACTION                        10I 0 VALUE
     D* Subscription Request Options
     D SBROPT                        16A
     D* Completion code
     D CMPCOD                        10I 0
     D* Reason code qualifying CompCode
     D REASON                        10I 0
Parent topic: Function calls on IBM i