08-21-2014 11:00 AM
Hello, I have a process that will send me an email if there are errors found in a log file. It has been working fine until the other day when I didn't receive the email. When I checked the data was incorrect but I didn't get to see the log because the file overwrites itself. The issue that the email didn't go out is that the length of the message was really large.
I'm using code similar to this code:
options emailsys=smtp emailhost=test.smtp.com emailport=89;
filename mymail email "email@example.com" subject="TEST ERROR";
data _null_ ;
set DataDump ;
file mymail ;
put ErrorText ;
I want to put checks in so the message will not exceed this size so I can still see that there are issues and check the log right away. Thank you.
08-21-2014 11:18 AM
My solution has been to write the log to a dataset (proc printto) and attach the file to the email. In your data _null_ step; can you strip/substr/etc.. ErrorText text into smaller sizes (100 characters) then put the smaller sizes? For example, I would write DataDump to a file and then attach the file to my email.
08-21-2014 11:30 AM
jwillis, Thank you so much. That is a great idea. I will try that out. Another thing I was going to try was to limit the number of rows to 100 and at least that would tell me something is wrong and I can get an idea of what the situation is. Thank you