Date: Wed, 31 Mar 2004 18:21:56 -0500
Reply-To: Don Stanley <don_stanley@PARADISE.NET.NZ>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Don Stanley <don_stanley@PARADISE.NET.NZ>
Subject: Calling WINZIP from SAS Problem.
I have created the following macro, which carries out either a standard SAS
copy of a file, or a WINZIPed copy. I have a problem with the WINZIP part.
It often hangs after creating very small portion of the WINZIP file. The
data step that calls the pipe continues to execute.
The temporary file that WINZIP creates is stuck at 385kb in size. I have
left this running overnight, but it never gets going again. It is also very
difficult to break the process in SAS, I think SAS is using zero CPU cycles
while the pipe command is running. It requires to kill the pipe process
before SAS can stop the data step running.
After a few hours running, SAS just shuts down. I assume then this process
is eating memory. There is a rather cryptic message in the SAS log that
doesn't give me many clues ...
Searching... ... ..
The squares are what is seen in the log. To me it looks like the process is
scanning disk looking for something.
Running on NT, Service Pack 6, SAS 8.2.
If I take the batch file that the macro created, and run that at a command
prompt, it works fine and takes under 5 minutes for a 1 gig file. The
problem only happens with bigger files, small files with a few fields and
observations do not hang (so far).
Has anyone got any ideas what may be going on here?
Here is the macro.
%macro permcopy(dset=,winzip=NO,directory=&report_location\sas datasets) ;
/* get the libname and member name */
%if %sysfunc(index(&dset,.)) %then %do ;
%let lib = %sysfunc(scan(&dset,1)) ;
%let mem = %sysfunc(scan(&dset,2)) ;
%else %do ;
%let lib = WORK ;
%let mem = &dset ;
%if &WINZIP ne YES %then %do ;
/* use a proc copy based approach */
libname sasdsets "&directory" ;
proc copy in=&lib out=sasdsets ;
select &mem ;
%if %sysfunc(exist(sasdsets.&mem._&this_month)) = 1 %then %do ;
/* it already exists, delete it */
proc datasets lib=sasdsets nolist ;
delete &mem._&this_month ;
proc datasets lib=sasdsets nolist;
change &mem=&mem._&this_month ;
libname sasdsets clear ;
%else %do ;
/* use WINZIP interface */
%let from = %sysfunc(pathname(&lib))\&mem..sas7bdat;
%let to = &directory\&mem._&this_month..zip ;
data _null_ ;
file 'c:\temp\dozip.bat' lrecl=512;
put 'c:' ;
put 'cd c:\Program Files\NicoMak\WinZip8' ;
put 'wzzip.exe -sMYPASSWORD ' "" "&to" "" ' ' "" "&from" "" ;
filename runzip pipe 'c:\temp\dozip.bat' lrecl=512;
data _null_ ;
infile runzip ;
put _infile_ ;
filename runzip clear ;
%mend permcopy ;
Note that the &this_month variable is just text like FEB2004 used to
differentiate the backups that could be created when this system produces
A dozip.bat file created by this follows:
cd c:\Program Files\NicoMak\WinZip8
wzzip.exe -sMYPASSWORD "G:\Credrisk
Scoring\development\report_programs\Behaviour Scoring Reports\Account
datasets\all_current_account_recs_FEB2004.zip" "C:\TEMP\SAS Temporary
A sample call of the macro is ...
libname test 'C:\TEMP\SAS Temporary Files\_TD296' ;
%let this_month = FEB2004 ;
%permcopy(dset=test.all_current_account_recs, WINZIP=YES, directory=c:)
Here is the result of running the macro against a small (5kb) dataset.
NOTE: The infile RUNZIP is:
Unnamed Pipe Access Device,
C:\Program Files\SAS Institute\SAS\V8>cd c:\Program Files\NicoMak\WinZip8
C:\Program Files\NicoMak\WinZip8>wzzip.exe -
sMYPASSWORD "c:\gbi_sum_FEB2004.zip" "C:\TEMP\SAS
WinZip(R) Command Line Support Add-On Version 1.0 (Build 3181)
Copyright (c) WinZip Computing, Inc. 1991-2000 - All Rights Reserved
creating Zip file c:\gbi_sum_FEB2004.zip
Searching... ... .. ..
NOTE: 11 records were read from the infile RUNZIP.
The minimum record length was 0.
The maximum record length was 134.
NOTE: DATA statement used:
real time 0.09 seconds
cpu time 0.00 seconds
NOTE: Fileref RUNZIP has been deassigned.
Still getting the searching message .... but only when called from SAS, I
don't see it at a dos prompt.