Writing to the Log file from a transformer in a Parallel Job

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
CharlesNagy
Premium Member
Premium Member
Posts: 66
Joined: Mon Feb 21, 2005 10:40 am
Location: Paris

Writing to the Log file from a transformer in a Parallel Job

Post by CharlesNagy »

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?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
CharlesNagy
Premium Member
Premium Member
Posts: 66
Joined: Mon Feb 21, 2005 10:40 am
Location: Paris

Post by CharlesNagy »

Thanks Ray,

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.
CharlesNagy
Premium Member
Premium Member
Posts: 66
Joined: Mon Feb 21, 2005 10:40 am
Location: Paris

Function to write to the Log File

Post by CharlesNagy »

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.

Code: Select all

void writeLog(char *logMsg)
{
     cout << logMsg << endl;

     return ;
}

It appears in the log with an APT_CombinedOperatorController event...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

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.
Post Reply