My etl jobs will update a log table based on pending purchase order.
Based on pending list of PO, i need to find manger order and send email request them to approve it.
So its basically a table with list of pending order and manger id(with all details like to,from,subject, body of email details in table) who is responsible for it. How i can send email after reading table. each row in a table needs separate email.
If anyone knows solution, please let me know.
Sending email from parallel jobs
Moderators: chulett, rschirm, roy
You can use the operating system to send emails. Which means you can do it in a parallel job by calling the OS to do it on your behalf.
Otherwise, you can have the parallel job(s) write the email body(s) to a text file(s), and pop out to a post-processing sequence that can use the built in email sending functionality.
I have a crude way to do it:
unyx('mail -s "You Have a Test Failure" ': jp_EmailAddr :' < /dev/null
')
where unyx is an extremely simple c++ program:
#include <cstdlib>
using namespace std;
int syscall(char* cmd)
{
system(cmd);
return 0;
}
(unyx becomes a routine in datastage and is invoked in a transformer).
You can obviously make this more fancy, and embed html or attachments or links and all in your email. And system is not really a good command to use (spawn, etc, have safer versions). But it shows you the approach.
Otherwise, you can have the parallel job(s) write the email body(s) to a text file(s), and pop out to a post-processing sequence that can use the built in email sending functionality.
I have a crude way to do it:
unyx('mail -s "You Have a Test Failure" ': jp_EmailAddr :' < /dev/null
')
where unyx is an extremely simple c++ program:
#include <cstdlib>
using namespace std;
int syscall(char* cmd)
{
system(cmd);
return 0;
}
(unyx becomes a routine in datastage and is invoked in a transformer).
You can obviously make this more fancy, and embed html or attachments or links and all in your email. And system is not really a good command to use (spawn, etc, have safer versions). But it shows you the approach.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You can use the visual basic transformer stage (it looks like, but isnt a transformer) to call a VB routine (a parallel routine) which in turn can call this function. I *think*. I did it with the C code, because that also gave me access to anything that can be done from the command line, which is handy from time to time esp when your datastage account has more power than your own (Including unlimited emails, here) (whistles and walks away).
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Use a server (or parallel) job to read the table and store the result. I prefer a server job, which can store the result in the job's user status area.
In the sequence get the value of the user status area, convert if necessary into a delimited list (using a user variable), and use that list to drive a Start Loop activity. Within the loop, use a Notification activity to send the email.
In the sequence get the value of the user status area, convert if necessary into a delimited list (using a user variable), and use that list to drive a Start Loop activity. Within the loop, use a Notification activity to send the email.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.