Attachments 0kbs in Notification Activity
Moderators: chulett, rschirm, roy
Attachments 0kbs in Notification Activity
Hi everybody...
i have a problem with DS..
i create log error files as #path#/#RoutineActivity.$ReturnValue#_error.log... so, as you understand, log names are dynamic every run of the job... then i go back to my sequence and send notification mail with these files attached. But, if these files, even if created, are empty (0kb), a mail arrives with
"WARNING - MISSING ATTACHMENT: Cannot open attachment file " + resolvedFileCompletePath
Is there a way to attach in any case, or better, to write an expression which could say something like "if files are empty, do not attach"?
Remember that sometimes i can create 10 different files, 8empty and 2 full, and no one will be attached..
Hope my problem is clear...
Thank you
A.
i have a problem with DS..
i create log error files as #path#/#RoutineActivity.$ReturnValue#_error.log... so, as you understand, log names are dynamic every run of the job... then i go back to my sequence and send notification mail with these files attached. But, if these files, even if created, are empty (0kb), a mail arrives with
"WARNING - MISSING ATTACHMENT: Cannot open attachment file " + resolvedFileCompletePath
Is there a way to attach in any case, or better, to write an expression which could say something like "if files are empty, do not attach"?
Remember that sometimes i can create 10 different files, 8empty and 2 full, and no one will be attached..
Hope my problem is clear...
Thank you
A.
A workaround -
Check if the file is empty or not by writing a script.
Based on the results, pass the output to two seperate output links which each end in Notification Activity
First Notification Activity you use the attach file option (for files size greater than 0)
Second Notification Activity you dont use the attach file option (for files size 0)
Makes sense?
Check if the file is empty or not by writing a script.
Based on the results, pass the output to two seperate output links which each end in Notification Activity
First Notification Activity you use the attach file option (for files size greater than 0)
Second Notification Activity you dont use the attach file option (for files size 0)
Makes sense?
Narasimha Kade
Finding answers is simple, all you need to do is come up with the correct questions.
Finding answers is simple, all you need to do is come up with the correct questions.
This is not a DataStage task. A UNIX script would be akin to a Windows 'bat' or batch file, something that runs a series of commands. There should be someone where you work who could create or help you create a simple korn shell script to get your feet wet. Then we can help you work it into your job.stivazzi wrote:your answer would make sense, but still i got 2 doubts:
1- how to write a script? i am quite new in DS, not so able in writing scripts... any help would be appreciated
This confuses me... you can only attach one file per Notification Activity. Or does your job design have 10 of them in it?stivazzi also wrote:2 - and.. if i have 8empty files and 2 full? the error comes again... i should check for any file if could be attached...
Never mind, it does say 'Attachments' (plural) and supports a comma delimited list of filenames. That's going to make this very tricky as you would need to build a list of just the non-zero byte files for this to work, it sounds like. Never had a need to send more than one, hmmm...
You'll probably need to 'roll your own' custom routine to check file sizes and build a list of appropriate filenames. Then call the DSSendMail routine from there. Either that or have whatever job creates these files also zip them into a single archive, empties and all - then attach that single file via the Notification Activity stage. Me, I'd go for that solution.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
AFAIK the error message you are getting is not because your file is empty.
It is because the Notification Activity sequence is not able to find the specified file.
Check if the file exists before you are attaching it to the Notification Activity sequence.
Even better try and hard code the filename with the path and check if you get the same error (For both empty and Non-empty files, even if the file is empty you shoud not be getting such errors)
It is because the Notification Activity sequence is not able to find the specified file.
Check if the file exists before you are attaching it to the Notification Activity sequence.
Even better try and hard code the filename with the path and check if you get the same error (For both empty and Non-empty files, even if the file is empty you shoud not be getting such errors)
Narasimha Kade
Finding answers is simple, all you need to do is come up with the correct questions.
Finding answers is simple, all you need to do is come up with the correct questions.