The implementation of the Informatica external procedure TxINF_BankSoft::FV in
Step 4. Building the Module contains the following lines of code:
ostrstream ss;
char* s;
...
ss << "The calculated future value is: " << FV->GetDouble() << ends;
s = ss.str();
(*m_pfnMessageCallback)(E_MSG_TYPE_LOG, 0, s);
(*m_pfnMessageCallback)(E_MSG_TYPE_ERR, 0, s);
delete [] s;
When the Integration Service creates an object of type Tx<MODNAME>, it passes to its constructor a pointer to a callback function that can be used to write error or debugging messages to the session log. (The code for the Tx<MODNAME> constructor is in the file Tx<MODNAME>.cpp.) This pointer is stored in the Tx<MODNAME> member variable m_pfnMessageCallback. The type of this pointer is defined in a typedef in the file $PMExtProcDir/include/infemmsg.h:
typedef void (*PFN_MESSAGE_CALLBACK)(
enum E_MSG_TYPE eMsgType,
unsigned long Code,
char* Message
);
Also defined in that file is the enumeration E_MSG_TYPE:
enum E_MSG_TYPE {
E_MSG_TYPE_LOG = 0,
E_MSG_TYPE_WARNING,
E_MSG_TYPE_ERR
};
If you specify the eMsgType of the callback function as E_MSG_TYPE_LOG, the callback function will write a
log
message to the session log. If you specify E_MSG_TYPE_ERR, the callback function writes an
error
message to the session log. If you specify E_MSG_TYPE_WARNING, the callback function writes an
warning
message to the session log. Use these messages to provide a simple debugging capability in Informatica external procedures.
To debug COM external procedures, you may use the output facilities available from inside a Visual Basic or C++ class. For example, in Visual Basic use a MsgBox to print out the result of a calculation for each row. Of course, you want to do this only on small samples of data while debugging and make sure to remove the MsgBox before making a production run.
Before attempting to use any output facilities from inside a Visual Basic or C++ class, you must add the following value to the registry:
Add the following entry to the Windows registry:
\HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\PowerMart\Parameters\MiscInfo\RunInDebugMode=Yes
This option starts the Integration Service as a regular application, not a service. You can debug the Integration Service without changing the debug privileges for the Integration Service service while it is running.
Start the Integration Service from the command line, using the command PMSERVER.EXE.
The Integration Service is now running in debug mode.
When you are finished debugging, make sure you remove this entry from the registry or set RunInDebugMode to No. Otherwise, when you attempt to start PowerCenter as a service, it will not start.
Stop the Integration Service and change the registry entry you added earlier to the following setting:
\HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\PowerMart\Parameters\MiscInfo\RunInDebugMode=No
Restart the Integration Service as a Windows service.