06-23-2017 10:59 AM
I have a problem regarding file transfer via SAS Portal between plattforms. It´s a quite simple Task:
The user presses a button on my SAS Portal page which calls a Stored Process. That STP creates 1-n files in a loop and puts them in an archive.
ODS PACKAGE(LISTZIP) open nopf; //for every id provided, create an xml file and add it to the package ODS PACKAGE(LISTZIP) add file="&filepath._&i." mimetype="text/xml" TEXT;
ODS PACKAGE(LISTZIP) publish archive properties (archive_name="&l_archiv." archive_path="&l_work."); ODS PACKAGE(LISTZIP) close;
After file creation, I have tried either data set to _webout or proc stream to return the zip-file to the user
%LET RV = %SYSFUNC(appsrv_header(Content-disposition,%STR(attachment; filename=&fname.)));
%LET RV = %SYSFUNC(appsrv_header(Content-Type,application/octet-stream));
filename out "&outfile."; proc stream outfile=_webout; begin &streamdelim. readfile outfile; ;;;; run; /* or data step */ data _NULL_; file _WEBOUT; infile "&outfile."; input; put _INFILE_; run;
I download the archive on a windows client and open it, but it only shows one out of three files and if I try to open that file I get a CRC-error, file corrupted. Weirdly enough, this only happens if the files inside the archive are larger than a certain size.
Further can I access the produced archive on the Unix filesystem, transfer it to my machine wie ftp client and open it and its contents without any problems at all.
When hex-comparing the downloaded version with the ftp´d one, I can see there are a few '0A's in the downloaded version that are not in the ftp´d one and a few '0D's in the ftp´d version that are not in the downloaded one.
Having all these hints leads me to believe I have some issue regarding linebreak-formatting in transfer (0D Carriage-Return, 0A Line-Feed (Unix), 0D0A (Windows)). But I am not sure how to adress this issue. The files are generated and archived on the Unix-Server, how do I stream the archive to a client in SAS Portal to be accessible? I´m working with SAS 9.4
PS: As a workaround I´m sending the archive via Mail and it works without a problem. Strengthens my focus on the issue beeing transfer to the client via browser.
12-05-2017 12:12 PM - edited 12-05-2017 01:13 PM
Hello everyone. I have been faced almost with this issue about two years ago and I can't solve it yet.
As well as the TS, I can't use .zip archive (or any other archive) with appsrv_header function. Result file is corrupt and I can't open it.