The programming languages that can be used for a data-conversion exit are determined by the environment.
In this case, the Reason field in the DataConvExitParms parameter on input to the exit will have the value MQRC_TRUNCATED_MSG_ACCEPTED.
In this case, the Reason field in the DataConvExitParms parameter on input to the exit will have the value MQRC_NONE (if the receiving application provided a buffer that was big enough for the message).
The distinguishing characteristic of a truncated message is that the length provided to the exit in the InBufferLength parameter will be less than the length implied by the format name contained in the Format field in the message descriptor. The exit should therefore check the value of InBufferLength before attempting to convert any of the data; the exit should not assume that the full amount of data implied by the format name has been provided.
If the exit has not been written to convert truncated messages, and InBufferLength is less than the value expected, the exit should return MQXDR_CONVERSION_FAILED in the ExitResponse field of the DataConvExitParms parameter, with the CompCode and Reason fields set to MQCC_WARNING and MQRC_FORMAT_ERROR respectively.
If the exit has been written to convert truncated messages, the exit should convert as much of the data as possible (see next usage note), taking care not to attempt to examine or convert data beyond the end of InBuffer. If the conversion completes successfully, the exit should leave the Reason field in the DataConvExitParms parameter unchanged. This has the effect of returning MQRC_TRUNCATED_MSG_ACCEPTED if the message was truncated by the receiver's queue manager, and MQRC_NONE if the message was truncated by the sender of the message.
It is also possible for a message to expand during conversion, to the point where it is bigger than OutBuffer. In this case the exit must decide whether to truncate the message; the AppOptions field in the DataConvExitParms parameter will indicate whether the receiving application specified the MQGMO_ACCEPT_TRUNCATED_MSG option.
The following example illustrates how the exit that processes the format MYFORMAT should be declared in the C programming language:
#include "cmqc.h" #include "cmqxc.h" MQ_DATA_CONV_EXIT MYFORMAT; void MQENTRY MYFORMAT( PMQDXP pDataConvExitParms, /* Data-conversion exit parameter block */ PMQMD pMsgDesc, /* Message descriptor */ MQLONG InBufferLength, /* Length in bytes of InBuffer */ PMQVOID pInBuffer, /* Buffer containing the unconverted message */ MQLONG OutBufferLength, /* Length in bytes of OutBuffer */ PMQVOID pOutBuffer) /* Buffer containing the converted message */ { /* C language statements to convert message */ }
Notices |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
csqzak10394 |