Page 1 of 1

Sending email per records

Posted: Tue Sep 01, 2015 3:53 am
by yimwai
A new requirement is to send emails to different persons according to the records in one table updated by other application.
suppose the table has only 3 fields:receiver,content,issent
we need to query all the record with issent 'N' and send email for each record
the receiver is in column 'receiver' and content in 'content' ,after sending the email , issent should be set to 'Y'
Any ideas how to implement this?

Posted: Tue Sep 01, 2015 4:54 am
by ray.wurlod
Do you really think this is a suitable job for an ETL tool?

Surely the email server itself can be scripted to perform this task.

That said, yes it is possible with DataStage, probably easiest using a sequence job.

Posted: Tue Sep 01, 2015 7:05 am
by yimwai
I can not view your words after easiest using....
because the number of mails will not be more than 10, thus we don't want to have another application or script. could you please directly tell me which stages can be used?

Posted: Tue Sep 01, 2015 7:15 am
by qt_ky
I agree, that's not what DataStage is meant to do, but yes it can do it. It will become known as a spam server instead of an ETL application. Regretful.

Posted: Tue Sep 01, 2015 9:55 am
by ArndW
This type of work is often done, where a table is read into a job sequence to iterate one call per row - here each call would be to a mail stage rather than calling a job.

The simplest method is to have the sequence call a server job, which executes the SELECT and puts the collected result into the user status. This is then used in the calling sequence as the basis for a loop.

It is not a particularly clean solution, but is frequently used.