Need to mail attached file only when data is present

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

Moderators: chulett, rschirm, roy

Post Reply
senthilmp
Participant
Posts: 85
Joined: Mon Sep 22, 2008 6:11 am

Need to mail attached file only when data is present

Post by senthilmp »

Hi,

My aim is to attach file and send it through mail, if the file has records inserted into it.

Current Design:
The property of Seq file stage is Create file and First line as ColumnName- Checked.
Am trying to trigger mail attaching the file using unix script, if any records is inserted into the file. The problem i am facing here is , the mail is triggered even when there is no records passed in the file, because the file is having the column name created (since First line as column is checked).

Pls let me know how can i overcome this issue or is any better way to design this?

**Note: Subject changed to be more descriptive - Content Editor **
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

In UNIX script interrogate for a file that has more than one line, like;
LINECOUNT=`/usr/bin/wc -l <file>`
if [[ $LINECOUNT -gt 1 ]]; then
mail it.
fi
senthilmp
Participant
Posts: 85
Joined: Mon Sep 22, 2008 6:11 am

Post by senthilmp »

Thanks Robinson for your quick response. Its working now.
Great.
Post Reply