Email Notification

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Email Notification

Post by somu_june »

Hi,

I have requirment like this. I need to send a .csv file attachment in mail when there are records in the file, if there are no records then no need to send the attachment in the mail. Is there a way to find the records present or not in a file before sending an attachment .


Thanks,
Somaraju.
somaraju
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sure. You can write a routine to leverage O/S commands to test if a file exists, has records, etc and then decide what to do based on the results. For example branching to one of two Email Notification stages in a Sequence job, one of which includes the attachment and one that doesn't.

If your file contains a header record, size checks become a little trickier. You could also build a generic routine to use DSGetLinkInfo with the DSJ.LINKROWCOUNT InfoType to check to see if the job populating the file sent any records to it. I tend to prefer this approach.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

If you are using 7.5 or above then email has attachments. Earlier versions need to use blat.exe or some UNIX commands to do the attachments. EtlStats has a routine included to show you how to do it in either UNIX or DOS.

The UNIX diff command can show what has changed. If you can do your diff in SQL then EtlStats can send the results of any SQL command as an attachment. Part of the example sequences include row reports of the jobs run within the sequence.
Mamu Kim
Post Reply