Conversion processing

The queue manager performs the following actions if the GMCONV option is specified on the MQGET call, and there is a message to be returned to the application:

  1. If one or more of the following is true, no conversion is necessary:

    • The message data is already in the character set and encoding required by the application issuing the MQGET call. The application must set the MDCSI and MDENC fields in the MSGDSC parameter of the MQGET call to the values required, prior to issuing the call.

    • The length of the message data is zero.

    • The length of the BUFFER parameter of the MQGET call is zero.

    In these cases the message is returned without conversion to the application issuing the MQGET call; the MDCSI and MDENC values in the MSGDSC parameter are set to the values in the control information in the message, and the call completes with one of the following combinations of completion code and reason code:

    Completion code
    Reason code

    CCOK

    RCNONE

    CCWARN

    RC2079

    CCWARN

    RC2080

The following steps are performed only if the character set or encoding of the message data differs from the corresponding value in the MSGDSC parameter, and there is data to be converted:

  1. If the MDFMT field in the control information in the message has the value FMNONE, the message is returned unconverted, with completion code CCWARN and reason code RC2110.

    In all other cases conversion processing continues.

  2. The message is removed from the queue and placed in a temporary buffer which is the same size as the BUFFER parameter. For browse operations, the message is copied into the temporary buffer, instead of being removed from the queue.

  3. If the message has to be truncated to fit in the buffer, the following is done:

    • If the GMATM option was not specified, the message is returned unconverted, with completion code CCWARN and reason code RC2080.

    • If the GMATM option was specified, the completion code is set to CCWARN, the reason code is set to RC2079, and conversion processing continues.

  4. If the message can be accommodated in the buffer without truncation, or the GMATM option was specified, the following is done:

    • If the format is a built-in format, the buffer is passed to the queue manager's data-conversion service.

    • If the format is not a built-in format, the buffer is passed to a user-written exit which has the same name as the format. If the exit cannot be found, the message is returned unconverted, with completion code CCWARN and reason code RC2110.

    If no error occurs, the output from the data-conversion service or from the user-written exit is the converted message, plus the completion code and reason code to be returned to the application issuing the MQGET call.

  5. If the conversion is successful, the queue manager returns the converted message to the application. In this case, the completion code and reason code returned by the MQGET call will usually be one of the following combinations:

    Completion code
    Reason code

    CCOK

    RCNONE

    CCWARN

    RC2079
    However, if the conversion is performed by a user-written exit, other reason codes can be returned, even when the conversion is successful.

    If the conversion fails (for whatever reason), the queue manager returns the unconverted message to the application, with the MDCSI and MDENC fields in the MSGDSC parameter set to the values in the control information in the message, and with completion code CCWARN. See below for possible reason codes.