+

Search Tips | Advanced Search

MQSTAT (Retrieve status information) on IBM i

Use the MQSTAT call to retrieve status information. The type of status information returned is determined by the STYPE value specified on the call.


Syntax

MQSTAT (HCONN, STYPE, STAT, CMPCOD, REASON)


Usage notes

  1. A call to MQSTAT specifying a type of STATAPT returns information about previous asynchronous MQPUT and MQPUT1 operations. The MQSTAT structure passed on the call is completed with the first recorded asynchronous warning or error information for that connection. If further errors or warnings follow the first, they do not normally alter these values. However, if an error occurs with a completion code of CCWARN, a subsequent failure with a completion code of CCFAIL is returned instead.
  2. If no errors have occurred since the connection was established or since the last call to MQSTAT then a CMPCOD of CCOK and REASON of RCNONE are returned.
  3. Counts of the number of asynchronous calls that have been processed under the connection handle are returned by using three counters; STSPSC, STSPWC, and STSPFC. These counters are incremented by the queue manager each time an asynchronous operation is processed successfully, has a warning, or fails (note that for accounting purposes a put to a distribution list counts once per destination queue rather than once per distribution list).
  4. A successful call to MQSTAT results in any previous error information or counts being reset.


Parameters

The MQSTAT call has the following parameters:

    Hconn (MQHCONN) - input

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

    STYPE (10-digit signed integer) - input

    Type of status information being requested. The only valid value is:

      STATAPT
      Return information about previous asynchronous put operations.

    STS (MQSTS) - input/output

    Status information structure. See MQSTS (Status reporting structure) on IBM i for details.

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

      CCOK
      Successful completion.

      CCFAIL
      Call failed.

    REASON (10-digit signed integer) - output

    The reason code qualifying CMPCOD.

    If CMPCOD is CCOK:

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

    If CMPCOD is CCFAIL:

      RC2374
      (2374, X'946') API exit failed

      RC2183
      (2183, X'887') Unable to load API exit.

      RC2219
      (2219, X'8AB') MQI call entered before previous call complete.

      RC2009
      (2009, X'7D9') Connection to queue manager lost.

      RC2203
      (2203, X'89B') Connection shutting down.

      RC2018
      (2018, X'7E2') Connection handle not valid.

      RC2162
      (2162, X'872') Queue manager stopping

      RC2102
      (2102, X'836') Insufficient system resources available.

      RC2430
      (2430, X'97E') Error with MQSTAT type.

      RC2071
      (2071, X'817') Insufficient storage available.

      RC2424
      (2424, X'978') Error with MQSTS structure

      RC2195
      (2195, X'893') Unexpected error occurred.

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

    For detailed information about these codes, see:


RPG Declaration

     C*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
     C                      CALLP     MQSTAT(HCONN : ETYPE : ERR :
     C                                       CMPCOD : REASON)
The prototype definition for the call is:
     D.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
     DMQSTAT           PR                  EXTPROC('MQSTAT')
     D* Connection handle
     D HCONN                         10I 0 VALUE
     D* Status information type
     D STYPE                         10I 0 VALUE
     D* Status information
     D STATUS                       296A
     D* Completion code
     D CMPCOD                        10I 0
     D* Reason code qualifying CompCode
     D REASON                        10I 0
Parent topic: Function calls on IBM i

Last updated: 2020-10-04