DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
This topic has been marked "Resolved."
Author Message
atulgoel
Participant



Joined: 03 Feb 2009
Posts: 81
Location: Bangalore, India
Points: 866

Post Posted: Thu Aug 16, 2018 12:40 pm Reply with quote    Back to top    

DataStage® Release: 11x
Job Type: Parallel
OS: Unix
Hi,

How to send output of Query Result in the email body using datastage.

Example: I write the output of a query in a text file. Then content of text file or directly output of query, I want to send in Email Body

Thanks
Atul

_________________
Atul
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42944
Location: Denver, CO
Points: 221471

Post Posted: Thu Aug 16, 2018 2:04 pm Reply with quote    Back to top    

Unless something has changed in the newer versions (and it looks like it hasn't) the Notification Activity stage only supports files as attachments. However, that doesn't mean you can't do a couple of other things to get the results you want.

1) Write your own custom version of the existing DSSendMail routine and add that functionality, then use that routine to send email from a Sequence job rather than using the Notification Activity stage.

2) Write a script to send mail from the server using whatever mail software you have installed (sendmail, mailx, whatever) and build in that ability, then leverage the script via the Execute Command stage in a Sequence job or 'After Job' or wherever you like.

Both would take the filename containing the text to inline / inject into the email body as a parameter / argument.

_________________
-craig

The Old Ones were, the Old Ones are, and the Old Ones shall be. Not in the spaces we know, but between them. They walk serene and primal, undimensioned and to us unseen.
Rate this response:  
Not yet rated
atulgoel
Participant



Joined: 03 Feb 2009
Posts: 81
Location: Bangalore, India
Points: 866

Post Posted: Fri Aug 17, 2018 2:39 pm Reply with quote    Back to top    

Thanks for the reply. Is it possible to share the sample routine which can send the output of text file in Email body.

_________________
Atul
Rate this response:  
Not yet rated
atulgoel
Participant



Joined: 03 Feb 2009
Posts: 81
Location: Bangalore, India
Points: 866

Post Posted: Fri Aug 17, 2018 3:02 pm Reply with quote    Back to top    

I tried below in DSSendMail routine. Its sending email, but its not sending the content of file in email body

"From:atul@xxxxxx.com\nTo:atul@xxxxxx.com\nSubject:Hi ya\nAttach:/app/bb5g_etl/ATUL/email.txt\nBody:\n Execute_Command_1.$CommandOutput"

_________________
Atul
Rate this response:  
Not yet rated
atulgoel
Participant



Joined: 03 Feb 2009
Posts: 81
Location: Bangalore, India
Points: 866

Post Posted: Fri Aug 17, 2018 3:09 pm Reply with quote    Back to top    

Its working now. I used DSSendMailTester inbuilt routine.

_________________
Atul
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42944
Location: Denver, CO
Points: 221471

Post Posted: Fri Aug 17, 2018 5:02 pm Reply with quote    Back to top    

Hopefully you made of copy of it first and are using the copy with a more appropriate name.

_________________
-craig

The Old Ones were, the Old Ones are, and the Old Ones shall be. Not in the spaces we know, but between them. They walk serene and primal, undimensioned and to us unseen.
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours