DATA Step, Macro, Functions and more

Sending Email - LRECL is too small

Accepted Solution Solved
Reply
Contributor
Posts: 28
Accepted Solution

Sending Email - LRECL is too small

Hi,

I have created and exported an excel file (Using ODS tagsets,ExcelXP). Now am I trying to send that file via email with the following code:

%macro newrepmail (team, fileloc, recipient,desc);

FILENAME output EMAIL

SUBJECT="Test Subject"

FROM= "My Email Address"

TO= &recipient.

ATTACH=&fileloc.;

/* Sending email */

DATA _NULL_;

FILE output;

PUT "Test Body";

RUN;

%mend newrepmail;

%newrepmail (DLK,

             ("Location of the File"),

                ("Recipient"),

                WT MI);

I get the error: An attachment record was truncated. The attachment LRECL is too small.

Please can anyone advise of a way round this?

Many Thanks for your help,

cxkev



Accepted Solutions
Solution
‎05-21-2013 11:11 AM
Frequent Contributor
Posts: 91

Re: Sending Email - LRECL is too small

Cxkev- I was wrestling with this same item this morning.  I have a monthly batch that sends QA notifications to folks, and it has run without problems for a couple of years under first 9.2, and now 9.3.

I found a problem note that suggested putting the lrecl= in the attachment specification, and it worked for me.  http://support.sas.com/kb/4/425.html

We are running 9.3 (TS1M2) via remote login to a Windows 2008 server.

Hope this helps!

WendyT

%LET DAYO=%SYSFUNC(TODAY(),YYMMDDN8.) ;

FILENAME SENDMAIL EMAIL        

SUBJECT="SAMPLE QA REPORT"        

FROM="WendyT@ouraddress.com"        

TO=("person1@ouraddress.com"             "person2@ouraddress.com")        

ATTACH=("&QA_REPORTS\Monthly_Sample_QA_Report_&DAYO..HTML" LRECL=9999) ;

DATA _NULL_ ;  

FILE SENDMAIL ;  

PUT "Coded sample results for the last 120 days are attached" ;  

PUT "  " ;  

RUN ;

View solution in original post


All Replies
Super Contributor
Posts: 282

Re: Sending Email - LRECL is too small

Hi,

I searched for the error messages you reported and found the following links:

39996 - "ERROR: An attachment record was truncated" when sending Excel files as email attachments fr...

40143 - E-mail output from SAS® 9.2 fails when attachments have an LRECL value greater than 1000

I'm not sure which platform you're running SAS on, so I'm not sure which (if any) apply.

As a side note, I could not see the "desc" macro function parameter being used anywhere - may be it is in your full code; and I would recommend avoid using SAS statements for naming purposes, e.g. "output".

Hope that helps.

Regards,

Amir.

Solution
‎05-21-2013 11:11 AM
Frequent Contributor
Posts: 91

Re: Sending Email - LRECL is too small

Cxkev- I was wrestling with this same item this morning.  I have a monthly batch that sends QA notifications to folks, and it has run without problems for a couple of years under first 9.2, and now 9.3.

I found a problem note that suggested putting the lrecl= in the attachment specification, and it worked for me.  http://support.sas.com/kb/4/425.html

We are running 9.3 (TS1M2) via remote login to a Windows 2008 server.

Hope this helps!

WendyT

%LET DAYO=%SYSFUNC(TODAY(),YYMMDDN8.) ;

FILENAME SENDMAIL EMAIL        

SUBJECT="SAMPLE QA REPORT"        

FROM="WendyT@ouraddress.com"        

TO=("person1@ouraddress.com"             "person2@ouraddress.com")        

ATTACH=("&QA_REPORTS\Monthly_Sample_QA_Report_&DAYO..HTML" LRECL=9999) ;

DATA _NULL_ ;  

FILE SENDMAIL ;  

PUT "Coded sample results for the last 120 days are attached" ;  

PUT "  " ;  

RUN ;

Contributor
Posts: 28

Re: Sending Email - LRECL is too small

Hi,

I tried that but I still got the same error message. I'm using SAS 9.2. There was a option to install a hot fix on teh SAS site but I don't have those privelages on my work PC.

To get round the issue I simply removed the long text columns in my report, and instead, input a hyperlink within the report to take the user to a seperate report which will include the long text. As the seperate report is not being emailed it doesn't encounter the same error.

Thanks everyone for your help.

Occasional Contributor
Posts: 10

Re: Sending Email - LRECL is too small

can you try use 

 CONTENT_TYPE= (or CT=) option in the FILENAME statement for the attachment as shown in the example below:

   filename sendit email from="user@company.com"    to="someone@domain.com"    subject="Excel files from SAS"   attach=("myfile.xls" content_type="application/vnd.ms-excel");

 

official link: http://support.sas.com/kb/39/996.html

 

Mine works but my file corrupt, I guess because my SAS EG 4.3 version too lower.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 3803 views
  • 3 likes
  • 4 in conversation