Page 1 of 1

Writing generalized subroutine for sending emails

Posted: Fri Oct 26, 2007 12:40 pm
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,

Posted: Fri Oct 26, 2007 1:09 pm
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

Posted: Fri Oct 26, 2007 1:34 pm
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! :)

Posted: Fri Oct 26, 2007 3:00 pm
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

Posted: Fri Oct 26, 2007 3:33 pm
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! :)

Posted: Sat Oct 27, 2007 1:18 am
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.

Posted: Sat Oct 27, 2007 1:20 am
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.