0

I have to read Input file to get email id of employees and send each employee email. How can I do this using Datastage job? File looks like this, PERSON_ID|FName|LName|Email_ID

2 Answers2

1

DataStage itself offers a Notification Stage which is only available at the Sequence level. As your information is in the data stream of a job you could use a Wrapped Stage in order to send the mail from within a job. A wrapped stage allows to call a OS command for each row in your stream. Sendmail etc. could be used to send the mails like you wish.

I have implemented this recently. The wrapped stage is tricky so I would recommend to use it in a very simple way - use it to call the bash (or any other shell) and prepare the mail command upfront and simply send it to that stage.

MichaelTiefenbacher
  • 3,805
  • 2
  • 11
  • 17
  • wrapped stage option looks good but little complicated. I chose to write a quick script to read file data and send email in loop. – Ashu Kumar Mar 09 '22 at 06:12
0

There are some more options.

First is using the Wrapped Stage like Michael mentioned. Another method is writing a Parallel Routine to use in an ordinary parallel transformer, which is quite similar.


The simplest way of sending an email per row that I know of is using a server routine in a transformer.

Drawback is that server routines are deprecated and we're not yet sure how well they can be migrated to future versions of DataStage (CP4D). This should be considerd when doing this.

In each project you should have a folder Routines/Built-In/Utilities containing the server routines DSSendMailAttachmentTester and DSSendMailTester. These are originally meant to be used in the Routine Editor just for testing the backend wether it's actually able to send mail.

But you can also use them in a Transformer as well, as long as it's a BASIC Transformer. That means you can either write a server job using all old school stuff (which is probably not what you want), or you can use the BASIC Transformer in a parallel job. (Follow the link on how to enable it.) It gives access to BASIC transforms and functions.

I suggest copying the mentioned server routines to make your own custom one and maybe modify it to your needs.

Justus Kenklies
  • 440
  • 3
  • 10