Conversion processing on IBM® i
This information describes the processing performed by the queue manager in response to the GMCONV option.
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:- 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, before issuing the call.
- The length of the message data is zero.
- The length of the BUFFER parameter of the MQGET call is zero.
- 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:
- 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.
- 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.
- 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.
- 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.
- 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 typically 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.