Hi,
I am trying to write a message to the logfile from a parallel transformer if a certain condition is not met... eg:
If condition then pass Data else log message
I presume I will have to write a C++ routine, but I dont know what command to issue to accomplish this. I have tried a simple cout, but that doesn't work.
Any ideas anyone?
Writing to the Log file from a transformer in a Parallel Job
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 66
- Joined: Mon Feb 21, 2005 10:40 am
- Location: Paris
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
It will slow the job down immensely but it can be done. It's probably best to call your routine from a stage variable, so that you can discard the result. Write your routine using the C-language DataStage API; you probably need DSLogInfo() or DSLogWarn() somewhere within the code.
See Parallel Job Advanced Developer's Guide around page 7-6.
See Parallel Job Advanced Developer's Guide around page 7-6.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 66
- Joined: Mon Feb 21, 2005 10:40 am
- Location: Paris
Thanks Ray,
Will check it out...
Will check it out...
ray.wurlod wrote:It will slow the job down immensely but it can be done. It's probably best to call your routine from a stage variable, so that you can discard the result. Write your routine using the C-language DataStage API; you probably need DSLogInfo() or DSLogWarn() somewhere within the code.
See Parallel Job Advanced Developer's Guide around page 7-6.
-
- Premium Member
- Posts: 66
- Joined: Mon Feb 21, 2005 10:40 am
- Location: Paris
Function to write to the Log File
After closer inspection, cout actually works.
I wrote the following function which I call from a transformer, and it does indeed write to the log file.
It appears in the log with an APT_CombinedOperatorController event...
I wrote the following function which I call from a transformer, and it does indeed write to the log file.
Code: Select all
void writeLog(char *logMsg)
{
cout << logMsg << endl;
return ;
}
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
That's only because you have operator combination enabled. What you have described as the "event" is actually the Orchestrate operator that is posting the message. With operator combination disabled the message would be posted by a transform operator (that, curiously, would have the same name as your Transformer stage - magic!).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.