Send email while rejecting Records

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

hargun
Participant
Posts: 188
Joined: Mon May 16, 2011 7:41 pm
Location: United States

Send email while rejecting Records

Post by hargun »

Hi,

i have a sequential file and i am inserting the records to the Target DB2 table and also have a reject link to throw out the rejected records.
I need an email when the records get rejected.How do i can do this in Datastage?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

After the job completes, you check the row count down the link or the size of the file and send an email if it has been written to. A Sequence job is probably best to control this but it could be done via an After Job routine or batch file.
-craig

"You can never have too many knives" -- Logan Nine Fingers
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

You can write a server routine to count the rows in reject link.
Design a sequence job like first your main job activity runs then e-mail notification activity stage.call a routine in job activity with custom condition option.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Just want to emphasize there's no "while rejecting records" part to this but doing so afterwards is common and straight-forward.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Actually you can do it while rejecting records, but do you really want to send a separate email for each record rejected? The recipient(s) will quickly begin to hate you if you do. Therefore I'll not be explaining the technique.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
hargun
Participant
Posts: 188
Joined: Mon May 16, 2011 7:41 pm
Location: United States

Post by hargun »

thanks Ray for your response

yes each time mail should be send to the recipient .
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Seriously? So if 200 records were rejected you'd like to send 200 separate emails? :?

Now you've got me curious. Since I would never implement any such thing, perhaps Ray can share with us the mailbomb technique? From a purely informational / educational standpoint, of course!
-craig

"You can never have too many knives" -- Logan Nine Fingers
hargun
Participant
Posts: 188
Joined: Mon May 16, 2011 7:41 pm
Location: United States

Post by hargun »

Chullet,
Everytime job run and on each run if records rejected then email needs to be send one time for every run not for each individual rejectes records.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That's a kinder approach.

The suggestions given earlier are appropriate - either a Routine activity in the controlling sequence to get the link row count on the reject-handling link followed by a Notification activity to send the email, or an after-job subroutine to do the same.

The mailbomb technique is a BASIC Transformer stage fed by the reject-handling link, with a call to a routine that invokes DSSendMail().
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I figured we were having a communication issue and you already had the solution you needed. :wink:

Thanks Ray... simple enough.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I thought you might have worked "Spamalot" into the thread somewhere there, Craig. :lol:

Especially as it's playing in Denver (Buell Theater) next week.
http://www.denvercenter.org/buy-tickets ... about.aspx
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes indeed, it is! I really should go. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
venkateshrupineni
Participant
Posts: 15
Joined: Wed May 02, 2012 3:38 am

Post by venkateshrupineni »

use the below procedure,
jobactivity -> Execute condition -> UV Activity -> neted condition -> notification mail

Execute condition:-
cd reject file path;cat reject file|wc -l (if u r not passing metadat)
UV activity > if nested condition.commnad o/p > 0 then 1 else 0
nested condition -> UV.activity = 1
then link to notification activity it will drop an e-mail.

oterwise u can directly hadle it in uv activity level by using routine DSSendmailwithsubject

Thanks,
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

I do use a "spam generator" email job to send info messages to each office ( with a contact 'email list' thats vertically pivoted list of comma seperated email ids) if their records had a lookup failure - and I use exactly Ray's approach , but its a server job.

For a pure parallel approach , Im curious if an Unix Wrap stage ( Or External Filter ?? ) that calls mailx on a 'per row basis' can be made to work .
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

Im now thinking , the fact that an Unix Wrapped stage requires the command to be 'pipe-safe' precludes any usage of it on a per row mode.
Post Reply