Hey everyone,
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
Kind regards,
Mat
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.
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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.