Email from DS stage

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
hari
Participant
Posts: 8
Joined: Mon Mar 07, 2005 3:06 am
Contact:

Email from DS stage

Post by hari »

Hi ,

Is there any way to send email from DS based on some condition? For ex. I have to check color code condition for each record. if color code is 'red' then i have to send an one email with all records with colour code 'red'

Thanks in advance..
Hari
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hari,

you can specifically send mail in a stage from a Sequencer, via a DSSendMail subroutine call, or just by executing a UNIX or Windows shell and calling an appropriate command-line based mail program.

You can find details about using mail within DS by using the Forum's search facility.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sure. :wink:

Set up a link to a sequential file that your 'red' records get sent down. After that there are different ways to solve the next part of the puzzle.

You could write an 'after job' routine that uses DSGetLinkInfo to see how many rows went down that link and then, if it is greater than zero, use DSExecute to call a script (or sendmail or DSSendMail) to send the appropriate email. You'd have to handle the 'attaching' of the actual output file yourself.

If you are using a Sequencer job to control all this, something similar. A Routine Activity stage could call a generic routine (one that you write) to get that same link row count from the previously run job. Then a trigger from that stage could be linked to a Notification Activity stage when the return count is greater than zero. DataStage 7.5 supports attachments in the Notification Activity stage, so that part becomes even easier if you have that version. Otherwise, you'll need to fall back on the 'attach it yourself' scenario.

A couple of approaches to ponder...

(waves at Arnd who snuck in while I was typing)
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

{waves back at Craig from the other side of the big pond} Much better answer than mine!
pandu80
Participant
Posts: 50
Joined: Fri Apr 08, 2005 5:56 pm

Re: Email from DS stage

Post by pandu80 »

OR

create a sequential file with the color code = red .
Then write a routine to count the no of rows in that file.
From the Routine Activity call this routine and if Return Value is >=0 call Notification Activity.
Then u wil be all set
Thanks

hari wrote:Hi ,

Is there any way to send email from DS based on some condition? For ex. I have to check color code condition for each record. if color code is 'red' then i have to send an one email with all records with colour code 'red'

Thanks in advance..
Hari
Post Reply