12-11-2012 11:37 AM
i have a text file on linux.
i have a stored process that reads the file and streams it to _webout.
the user gets it in his browser as an attachment that opens in notepad.
in notepad, the lines don't end.
the reason is that the line termination string is LF ('0a'x), for notepad it should be CRLF ('0a'x'0d'x).
i tried tranwrd-ing 0a to 0d0a which did not work.
also file _webout termstr=crlf doesn't work.
can anyone tell me what would?
rc = stpsrv_header("Content-type","text/plain");
rc = stpsrv_header("Content-disposition","%str(attachment; filename=saslog.txt)");
file _webout termstr=crlf;
12-11-2012 04:10 PM
Because of your "termstr" option, I really think this should work. The only thing I can suggest is to use a hex editor and see what the termination character in your text file is. If it is crlf, SAS is working right and something's wrong with your viewer. If it's lf, I would report it to SAS tech support and see what they say.
12-11-2012 05:24 PM
> When you run a stored process with the Stored Process Server, any encoding value that you specify for the _WEBOUT fileref will be ignored.
this was fixed but maybe the same applies to the termstr option on _webout.
unless someone posts the solution i will report it to sasts tomorrow.
12-11-2012 05:15 PM
It may be that %qcmpress is removing them, at least from this quicky test code.
%let a = a long string that breaks across lines
here is the contination on another line.
There should be a crlf in here somewhere.;
Which on my system generates:
a long string that breaks across lines here is the contination on another line. There should be a
crlf in here somewhere.
The line break in the output provided by the LOG generator.
12-12-2012 03:40 PM
i reported it to sas techsupp.
in the meantime i fixed it putting in an extra '0d'x:
put _infile_ '0d'x;
i will post sas techsupp's answer when it arrives.
12-13-2012 10:56 AM
sas techsupp thinks that, although not documented, the termstr option is already implicitly applied and cannot be overwritten.
they suggest the following:
%LET EOL = '0a0d'x;
rc = STPSRV_HEADER('Content-type', 'text/plain');
rc = STPSRV_HEADER('Content-disposition', 'attachment; filename="saslog.txt"');
FILE _WEBOUT RECFM=V;
PUT 'De Sint zat te denken' &EOL;
PUT 'Wat voor CRLF hij zal schenken' &EOL;
PUT 'Een Sinterklaasgedicht op rijm' &EOL;
PUT 'Geschikt voor Windows met een "echte" new line' &EOL;