generateMsg()

Generates a message from a set of predefined messages in a message file.

Syntax

char * generateMsg(int msgNum, int msgType, char * info,
       int argCount, ...);
 

Parameters

msgNum [in]
Specifies the message number (identifier) in the message file.
msgType [in]
Is one of the following message-type constants defined in the CxMsgFormat class:

 XRD_WARNING 
 
  
 XRD_ERROR 
 
  
 XRD_FATAL 
 
  
 XRD_INFO 
 
  
 XRD_TRACE 
 
info [in]
Is an informational value, such as the name of the class for which the IBM WebSphere business integration system generated the message.
argCount [in]
Is an integer that specifies the number of parameters within the message text.
... [in]
Is a list of parameters for the message text.

Return values

A character pointer to the generated message.

Notes

The generateMsg() method allocates memory to store a generated message. When the connector has logged the message, it should call the freeMemory() method to release the allocated memory. This method is a member of the connector framework class JToCPPVeneer. The syntax of the call is:

void freeMemory(char * mem)
 

where mem is the memory allocated by generateMsg(). See the sample code below for an example of how to call this method.

Examples

char * msg;
 ret_code = connect_to_app(userName, password);
 // Message 1100 - Failed to connect to application
 if (ret_code == -1) {
    msg = generateMsg(1100, CxMsgFormat::XRD_ERROR, NULL, 0, NULL);
    logMsg(msg);
    JToCPPVeneer::getTheHandlerStuff()->freeMemory(msg);
    return BON_FAIL; 
 }
 

Copyright IBM Corp. 1997, 2004