| 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. |
|---|
Hello all
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 ...
Stderr output:
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)) ;
%end ;
%else %do ;
%let lib = WORK ;
%let mem = &dset ;
%end ;
%if &WINZIP ne YES %then %do ;
/* use a proc copy based approach */
libname sasdsets "&directory" ;
proc copy in=&lib out=sasdsets ;
select &mem ;
run ;
%if %sysfunc(exist(sasdsets.&mem._&this_month)) = 1 %then %do ;
/* it already exists, delete it */
proc datasets lib=sasdsets nolist ;
delete &mem._&this_month ;
quit ;
%end ;
proc datasets lib=sasdsets nolist;
change &mem=&mem._&this_month ;
quit ;
libname sasdsets clear ;
%end ;
%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" "" ;
run ;
filename runzip pipe 'c:\temp\dozip.bat' lrecl=512;
data _null_ ;
infile runzip ;
input ;
put _infile_ ;
run ;
filename runzip clear ;
%end ;
%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
monthly reports.
A dozip.bat file created by this follows:
c:
cd c:\Program Files\NicoMak\WinZip8
wzzip.exe -sMYPASSWORD "G:\Credrisk
Scoring\development\report_programs\Behaviour Scoring Reports\Account
Quarterly Misalignment\sas
datasets\all_current_account_recs_FEB2004.zip" "C:\TEMP\SAS Temporary
Files\_TD296\all_current_account_recs.sas7bdat"
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,
PROCESS=c:\temp\dozip.bat,RECFM=V,LRECL=512
G:\Credrisk Scoring\Development>c:
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
Temporary Files\_TD296\gbi_sum.sas7bdat"
WinZip(R) Command Line Support Add-On Version 1.0 (Build 3181)
Copyright (c) WinZip Computing, Inc. 1991-2000 - All Rights Reserved
Adding gbi_sum.sas7bdat
creating Zip file c:\gbi_sum_FEB2004.zip
Stderr output:
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.
Any ideas?
Thanks
Don
|