Desktop productivity for business analysts and programmers

Cleanwork command for /saswork and /sasutil cleanup

Reply
Regular Contributor
Posts: 151

Cleanwork command for /saswork and /sasutil cleanup

Hello,


am looking for Clean work command for saswork, sasutil files to cleanup.

As our saswork file is keeping growing most of the times and reaching 100 % and affecting other mounting points to reach 100%.

We are having space issues  most of the times,We are using SAS 9.2 on Solaris 5.10.


and I found there are lot of old files in /saswork

Please can you provide the Clean work command which I should be able run to clean saswork and free some space in it.

If am not wrong when I run this command so it will clean only  old inactive finisjed job process and any files which are related to old failed jobs

And any unnecessary files created when users have not closed their EG properly…etc right.

and  it does not interrupt any actively running’s sas/batch jobs right if I run this command or script.

Do I have to run only after hours or it can be executed at any time. please let me know.

Please can  provide the command or script,I need your help


Thank you all in Advance

Super User
Posts: 11,110

Re: Cleanwork command for /saswork and /sasutil cleanup

The following is likely dangerous untested code as far at the delete goes:

Put the name of the library, in uppercase in the place of WORK below, and specify a date that you want to remove all data sets that were last modified by. Note that data literals must be in that format with the d at the end.

proc sql noprint;

     select memname into : setlist separated by ' '

     from dictionary.tables

     where libname='WORK' and datepart(modate) le "01JAN2015"d;

quit;

You can look at the resulting list of member names by:

%put &setlist;

AFTER you are happy with the list. I would recommend looking at a few of the "oldest" sets first maybe just 2 or 3 if possible as a test.

Proc datasets library=WORK;

     delete &varlist / gennum=all;

run;

quit;

Regular Contributor
Posts: 151

Re: Cleanwork command for /saswork and /sasutil cleanup

am looking for command for cleaning the saswork and sasutil directories on Solaris server.

Thank you very much for your prompt reply

Super User
Posts: 11,110

Re: Cleanwork command for /saswork and /sasutil cleanup

If it is SAS code and the files are written by SAS then those files are in a SAS LIBRARY. The specific operating system doesn't matter though permissions of the job running the code could be. If you can write to that LIBRARY then you most likely can delete files. I do not know the path to your saswork or sasutil directories but the system running should have one or more SAS libraries pointing to that location.

Regular Contributor
Posts: 151

Re: Cleanwork command for /saswork and /sasutil cleanup

But does this code will delete only files that are related to inactive running jobs, jobs those are failed and unwanted files created when any user not opened or closed properly..etc and it should keep all the files of actively running jobs.

Directory of the files located on server is /sas/saswork

Super User
Posts: 19,052

Re: Cleanwork command for /saswork and /sasutil cleanup

What version of SAS do you have? A clean work utility or app ships with SAS.

cleanwork utility:

/sas/9.3/SASFoundation/9.3/utilities/bin

Regular Contributor
Posts: 151

Re: Cleanwork command for /saswork and /sasutil cleanup

Yes I have tried this  below code

sudo /sas/sashome/SASFoundation/9.2/utilities/bin/cleanwork /sas/saswork &

I heard I should not use the cleanwork command with sudo , and its suggested to use the command only with root id only.

Is that true,and is there any problem if i use with sudo.

and will it be ok to run this clean work  command at any time when any jobs are running or it has to be run

only when servers are down and jobs are not running.

Super User
Posts: 7,405

Re: Cleanwork command for /saswork and /sasutil cleanup

Every time a SAS process starts, a directory is created to which the WORK library is assigned. The name of this directory contains the process number of the SAS process in hexadecimal notation.

When the SAS process terminates normally, it removes the directory and all its contents. If a SAS process is terminated abnormally (crash, kill -9, system halt), the directory remains behind.

The SAS cleanwork utility checks if any SAS work directories are present in the named directory that do not have a matching process, and removes those.

All of the above also encompasses directories in the UTILLOC location, for which a separate run of the cleanwork utility will be necessary.

Since no running process's WORK directory can be affected, it is safe to run cleanwork at any given time.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Regular Contributor
Posts: 151

Re: Cleanwork command for /saswork and /sasutil cleanup

Hi sir

 

I had ran the cleanwork command and the files which are not in use got cleaned and some of other old directories which created in saswork with 8 chars " kxe1kech", "wkmc6rh6" I deleted manually.not sure why they are creating.

I believe if users are not closing or opening there EG or othe SAS Tools properly or not closing sas tool when their work is done by the end of the Day these files might be creating.

 

so after cleanining the saswork with clean command, still some times the saswork file system is slowly growing and reaching 100 % and affecting other sas file systems to reach 100%. few days back I observed that saswork started growing slowly by 1 % every 10-15 mins and within 10-12hrs it reached 100 % and also It effected other file systems /sas , /sas/egs, /sas/pws/user1/ to 100%.

 

even though  I cleared all files  in /saswork before that and space also I checked multiple times during this increasing and its not more than 100 MB.when it reached 100 % also I checked saswork and it was 100-120 MB occupied.

 

My Question is Why the /sas/saswork file system  reaching 100 %  and affecting other mounting points to reach 100 % when

only 100 MB space was occupied by /sas/saswork, and when /sas/sawork is occupying 24 to 130 GB space some times  it stays at 1%.

 

based on what the saswork is reaching 100% when it has plenty of Quota(5.5 TB) allocated for it

 

Filesystem                  size   used    avail   capacity    Mounted

zsasdrp/sas-saswork 20T    8.2G     5.5T     1%        /sas/saswork

 

It should not reach 100 % right when only 100MB space has been occupied by work files in saswork file system.

 

Some times /sas/saswork file system occupied even 130 GB also still it was 1 % but when it occupies 100MB or even 500 KB also it slowly growing step by step and reaching 100%.

 

Does saswork file system works on the Quota allocated 5.5 TB (or) the space allocated in sasv9.cfg or sasv9_usermods.cfg

 

I would really appreciate if any one can answer and provide a resolution for this

 

Thanks alot in Advance

Trusted Advisor
Posts: 2,114

Re: Cleanwork command for /saswork and /sasutil cleanup

[ Edited ]

It's probably time to call tech support.

 

Alternatively, you can engage your Solaris support to monitor the /saswork to identify the subdirectories that are growing.  You could have a user who is iteratively adding files (with poor programming technique, IMHO) and not cleaning up within a session.

Ask a Question
Discussion stats
  • 9 replies
  • 2255 views
  • 0 likes
  • 5 in conversation