Writing generalized subroutine for sending emails

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
shankar_ramanath
Premium Member
Premium Member
Posts: 67
Joined: Thu Aug 09, 2007 7:51 pm

Writing generalized subroutine for sending emails

Post by shankar_ramanath »

I have a sequence that contains several jobs (> 25). When any one of the job aborts, I need to send an email and abort the sequence. The only way by which I know how to do this is to attach a Notification Activity and Terminator to EACH of the jobs in the sequence. This is cumbersome and makes the sequence unreadable.

Is there a better way of doing this? I have tried the following

1. I created a separate sequence (I will call this sub-sequence) that contains a Notification Activity and Terminator (in that order) thinking that I could call this sub-sequence from each of the jobs in the main sequence (this would still be cumbersome but at least I will need to call one sub-sequence from each job in the main sequence rather than calling both Notification Activity and Terminator from each job in the main sequence). The new sub-sequence I created did not compile because it was expecting an input to the Notification Activity within that sequence
2. I added one Notification Activity and Terminator combination in the main sequence with the hope that I could attach more than one job to this combination. This did not work as well because multiple inputs could not be attached to a single Notification Activity

Currently I am using the trigger "Unconditional" to pass from one job to the next within the main sequence. For passing the control to Notification Activity and Terminator I am using the trigger "Failed Conditional"

I have already looked through the posts and did not find any messages which surprises me because I am thinking that I am definitely missing something.

Could you guys help out?

Thanks,
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Welcome Aboard!

You can drop in an Exception Activity.

If there is any exception, i.e. if any of your jobs fail, the control goes to the Exception Activity.
Now connect a Notification activity and a terminator to the Exception Activity.
This way you dont clutter up the sequence.

HTH
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

narasimha wrote:Welcome Aboard!

You can drop in an Exception Activity.

If there is any exception, i.e. if any of your jobs fail, the control goes to the Exception Activity.
Now connect a Notification activity and a terminator to the Exception Activity.
This way you dont clutter up the sequence.

HTH
Hi,

How about including the generic DSSendMail routine in the job control of each job? If the WaitforJob() returns an errorcode > 0 then the DSSendMail routine gets kicked off.

I think it is also a viable option along with the above solution!
Let me know if I am wrong! :)
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

vivekgadwal wrote: Hi,

How about including the generic DSSendMail routine in the job control of each job? If the WaitforJob() returns an errorcode > 0 then the DSSendMail routine gets kicked off.

I think it is also a viable option along with the above solution!
Let me know if I am wrong! :)
It can be coded, but I guess it is an overkill.

Prior to Version 7.x, you did not have the luxury of using the Exception Activity. Why do you want to take a step back and code it.

YMMV
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

narasimha wrote:
vivekgadwal wrote: Hi,

How about including the generic DSSendMail routine in the job control of each job? If the WaitforJob() returns an errorcode > 0 then the DSSendMail routine gets kicked off.

I think it is also a viable option along with the above solution!
Let me know if I am wrong! :)
It can be coded, but I guess it is an overkill.

Prior to Version 7.x, you did not have the luxury of using the Exception Activity. Why do you want to take a step back and code it.

YMMV
Well, you are right. I am working on 7.0 right now and I am thinking in that terms! :)
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
shankar_ramanath
Premium Member
Premium Member
Posts: 67
Joined: Thu Aug 09, 2007 7:51 pm

Post by shankar_ramanath »

[quote="narasimha"]Welcome Aboard!

You can drop in an Exception Activity.

If there is any exception, i.e. if any of your jobs fail, the control goes to the Exception Activity.
Now connect a Notification activity and a terminator to the Exception Activity.
This way you dont clutter up the sequence.

HTH[/quote]

Thanks Narasimha. That solved the problem. I appreciate your help very much.
shankar_ramanath
Premium Member
Premium Member
Posts: 67
Joined: Thu Aug 09, 2007 7:51 pm

Post by shankar_ramanath »

[quote="narasimha"]Welcome Aboard!

You can drop in an Exception Activity.

If there is any exception, i.e. if any of your jobs fail, the control goes to the Exception Activity.
Now connect a Notification activity and a terminator to the Exception Activity.
This way you dont clutter up the sequence.

HTH[/quote]

Thanks Narasimha. That solved the problem. I appreciate your help very much.
Post Reply