Email Notification
Moderators: chulett, rschirm, roy
Email Notification
Hi,
I'm a bit new to DataStage so please bear with me. I need to send an email notification when a lookup rejects a file. Does anyone know the easiest way to implement this?
Thanks!
I'm a bit new to DataStage so please bear with me. I need to send an email notification when a lookup rejects a file. Does anyone know the easiest way to implement this?
Thanks!
Since the job only "rejects" the rows that are not found in the lookup and the results are sent to a reject file via a reject link and the process continues then the status of the job is considered complete. What I want to do is to be able to send an email if there are rejects within that file. So the process should continue regardless of the rejects, I just want to notify someone that there were rejects and that they should have a look at those rejects.
rajeevm wrote:I think you can do it a job sequence . You can give the status of the job whether its failed or completed. You can even give the multiple recipients names seperated by a comma.
Or build a Sequence job. A Routine Activity can check to see if anything was written down the reject link, or a Command Activity can check the size/row count of the file. If a non-zero value is found, the Notification Activity can be triggered to send an email and attach the file as well.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Again bear with me because I'm a novice in DS.
My issue is that I only want to send the email when there are rejected records. A lookup always recreates the reject file regardless if there are any rejected records. With the approach you mention below, the email would be sent all the time regardless if I had any reject records?
My issue is that I only want to send the email when there are rejected records. A lookup always recreates the reject file regardless if there are any rejected records. With the approach you mention below, the email would be sent all the time regardless if I had any reject records?
koolsun85 wrote:Use After Job Subroutine DSSendMail to send an email and attach the rejected file in the job itself.
You could also write your own 'After Job' subroutine that did basically the same check I mentioned earlier and then conditionally called DSSendMail. If you do, make sure you Annotate that on the canvas and (perhaps) set the After Job area to run only if things are ending... gracefully.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
That's certainly another way - if we're talking about a Server job here.rsunny wrote:Find the number of rows that are going into the reject link and use DSSETUSERSTATUS of the row count and keep the job in sequence and trigger to send an email with the user status if it is greater than zero.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Hi Craig: I really appreciate the advice you've given thus far.
Would you know the best place to research on Routine Activities? I've never used one so I don't know how to check the reject link.
Would you know the best place to research on Routine Activities? I've never used one so I don't know how to check the reject link.
chulett wrote:Or build a Sequence job. A Routine Activity can check to see if anything was written down the reject link, or a Command Activity can check the size/row count of the file. If a non-zero value is found, the Notification Activity can be triggered to send an email and attach the file as well.
Search here for examples of using the DSGetLinkInfo() function with the (off the top of my head) DSJ.LINKROWCOUNT InfoType. Build a generic routine that takes three arguments - job name, stage name and link name - then attach to the job, interrogate the link, set the return value to that count and then detach from the job. That would work for a Sequence job.
If you are going the After Job route, you can skip the job name and attach bits and use DSJ.ME as the handle. It means the executing job that called it.
If you are going the After Job route, you can skip the job name and attach bits and use DSJ.ME as the handle. It means the executing job that called it.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers