| SAS Companion for the OpenVMS Environment |
Disk space
is the aspect of the WORK library that is most likely to require your consideration.
If you have many large temporary SAS data sets, or if you use a procedure
that has many large utility files (for example, a PROC FREQ step with a complex TABLES statement
that you run against a large SAS data set), you may run out of disk space
in the WORK library. If you run out of disk space in batch mode, your PROC
or DATA step terminates prematurely and issues a message similar to the one
shown in Insufficient WORK Space Message.
In an interactive session, a dialog window asks you to specify what action
to take.
Insufficient WORK Space Message
ERROR: Insufficient space in file WORK.DATASET.DATA.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: SAS set option OBS=0 and will continue to check statements.
This may cause NOTE: No observations in data set.
WARNING: The data set WORK.DATASET may be incomplete. When this step
was stopped there were 22360 observations and 4 variables.
ERROR: Errors printed on page 1.
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC 27513 |
Ask your system administrator to increase the disk quota
that has been assigned to you, or ask for the disk to be cleaned up. Following
are several methods of increasing your WORK space:
You can also combine these methods.
By
default, a subdirectory of the current directory contains the WORK data library.
The name of the subdirectory that SAS creates for your WORK data library is SAS$WORKcurrent-pid, where
current-pid is the unique 8-byte process-identification
value that is assigned by OpenVMS. By
default, this directory is created as a subdirectory of the directory that
is referenced by the OpenVMS logical
name SAS$WORKROOT. SAS$WORKROOT refers
to SYS$DISK:[ ], but your system manager
may have redefined it. The default may be changed when the SAS System is installed
by your system manager.
You can change the location of the WORK data library
either by redefining the OpenVMS logical
name SAS$WORKROOT or by specifying
the WORK= system option. For example, the following SAS command tells SAS
to create the WORK subdirectory in the directory DISK:[XDIR]:
$ SAS7/WORK=DISK:[XDIR]
When SAS creates the WORK subdirectory, it also creates
an OpenVMS process-level logical name, SAS$WORKLIB,
that references the WORK data library. You can use this logical name within
the SAS session to reference files in the WORK subdirectory. It remains defined
after the SAS session terminates.
Under
OpenVMS, temporary SAS data set means a data set that is stored
in a temporary SAS work library. That is, you cannot designate the data set
itself as temporary, but the data set takes on the attribute of the library
in which it is stored.
One simple way to conserve space in the WORK library
is to delete each temporary SAS data set with a PROC DATASETS step
after you no longer need it. However, there are two problems with this method.
An
alternative to deleting the temporary SAS data sets is to direct them to a
different SAS data library. You can use the USER= system option to store temporary
data sets in the USER library rather than in the WORK library.
Note:
Utility data sets that are created by SAS procedures continue
to be stored in the WORK library. However, any data sets that have one-level
names and that are created by your SAS programs will be stored in the USER
library.
The following example illustrates the use of the USER= system
option. The numbered lines are explained following the code.
filename giant 'mydisk:[survey]tvdata.dat';
libname result 'mydisk:[sasdata]';
[1] libname temp 'disk2:[temp]';
[2] options user=temp;
[3] data totalusa;
infile giant;
input home_id region income viewers cable;
if home_id=. then delete;
run;
[4] proc freq;
tables region*income*viewers*cable
[5] / noprint out=result.freqdata;
run;
-
The LIBNAME statement associates the libref TEMP
with the directory DISK2:[TEMP].
-
In the OPTIONS statement, the USER= system option
designates the TEMP libref as the temporary SAS data library. Any data sets
that have one-level names and that are created by your SAS program will be
stored in this library.
-
A one-level name is used in the DATA statement.
When the DATA step is processed, the SAS data set TEMP.TOTALUSA is
created.
-
Because the large TOTALUSA data
set was directed to the TEMP library, there is more space available in the
WORK library for the utility files that the FREQ procedure requires.
-
The SAS data set FREQDATA contains
the results of the FREQ procedure. A two-level name is used to store FREQDATA in
the permanent SAS data library MYDISK:[SASDATA].
Note:
You can also assign the USER libref directly by
using the LIBNAME statement as follows:
libname user '[mydir]';
You can specify the USER= system option in the SAS command,
as in the following example:
$ SAS7/USER=[MYDIR]
Note:
Unlike the WORK library, when you use the user
library to store temporary files, these files are not automatically deleted
when the SAS System terminates.
Two system options control
the creation and deletion of the WORK subdirectory. By default, the WORK subdirectory
is deleted at the end of each SAS session, and a new one is created at the
beginning of the next session. The WORKTERM system
option controls the deletion of the WORK subdirectory, and the WORKINIT system
option controls the creation of the new subdirectory.
The default value of the WORKINIT system
option is WORKINIT, and the SAS System
automatically creates a WORK subdirectory as it initializes. If you specify NOWORKINIT, the
SAS System looks for an existing WORK subdirectory in the current directory
and uses it, as is, if it exists. If it does not exist, one is created. You
can specify the WORKINIT system option
in the SAS command or in a configuration file.
If you have logged out of your OpenVMS process
since the previous WORK subdirectory was saved, the SAS System cannot find
the WORK data library even if you specify NOWORKINIT, so
it creates a new WORK data library. This is because your OpenVMS process
ID has changed and the subdirectory name includes the OpenVMS process
ID. In this case, the old WORK data library still exists (it was not written
over), and you can assign a new libref to the old WORK subdirectory (SAS$WORKold-pid) after you get into your SAS session
and use the files through the new libref. Search the default directory for
the old SAS session to find the old WORK subdirectory name. You can use the
X statement within your current SAS session to perform this directory search.
The WORKTERM option controls whether the WORK subdirectory
is deleted at the end of your SAS session. The default value is WORKTERM. If
you specify NOWORKTERM, the WORK subdirectory
is not deleted at the end of the session and remains available for use with
the next SAS session. Remember, however, that you must specify NOWORKINIT in
the next invocation of the SAS System in order to reuse the WORK subdirectory
that you saved.
The WORKTERM and WORKINIT system options are portable
and are documented in SAS Language Reference: Dictionary.
Under
OpenVMS, the CLEANUP tool is available
to conveniently delete the WORK data library. When a SAS session terminates
normally, the WORK library is deleted automatically (this is the default action).
However, if your SAS session terminates abnormally, the WORK library and the
files in it may not be deleted properly. To delete this WORK data library,
use the CLEANUP tool.
- CAUTION:
- Do not use the CLEANUP tool if your
default directory is also the default directory for a SAS batch job, and a
SAS batch job is currently running.
If you
inadvertently delete the WORK subdirectory that was created for a batch job,
the job abends. Also, never issue the CLEANUP command
from an OpenVMS subprocess.
![[cautend]](../common/images/cautend.gif)
To access the CLEANUP tool,
first create a DCL symbol that points to the executable image. This symbol
or foreign command can be added to the SAS7.COM file.
The symbol CLEANUP is used in the following
example:
$ CLEANUP == "$SAS$ROOT:[PROCS]CLEANUP.EXE"
Then, issue the CLEANUP command
from your DCL prompt to delete WORK data libraries from one or more directories.
The following are some syntax variations to keep in
mind:
-
To clean the current directory of work files, type
-
$ CLEANUP
-
To clean work files from [.TEMP], type
-
$ CLEANUP [.TEMP]
-
To clean work files from an entire directory tree, type
-
$ CLEANUP [...]
The CLEANUP command accepts the following qualifiers:
-
/LOG
| /NOLOG
-
/LOG is the default. This causes the CLEANUP tool
to issue a message showing each file as it is deleted, and it shows how many
directories were deleted. If you specify /NOLOG, no
messages are issued unless the CLEANUP tool
encounters an error while trying to delete one or more files.
-
/CONFIRM | /NOCONFIRM
-
/CONFIRM is the default. This causes the CLEANUP tool
to prompt you for each directory to be deleted. The default is Y for yes if
you press RETURN. If you do not want to be prompted, or if you are submitting
the command from a batch job, then use /NOCONFIRM.
Note:
The /V5 | /NOV5 and /V6 | /NOV6
options for the CLEANUP command are
not supported in Version 7 of the SAS
System.
For each WORK data library that exists in the specified
directory, the CLEANUP tool issues
the question
OK to delete
device:[dir]SAS$WORKnnnnnnnn.DIR;1 [YES]?
where
device:[dir]
is the name of the disk and directory to which you were attached when you
invoked the SAS System, and
SAS$WORKnnnnnnnn.DIR;1 is the subdirectory
that contains the WORK library. YES is the default response, so to execute
the CLEANUP command, press the RETURN key.
When the CLEANUP tool executes, it
lists the names of the files being deleted. If the specified directory contains
more than one WORK subdirectory, the CLEANUP tool
then issues the previous question for the next WORK data library.
If the CLEANUP tool is not available at your site, contact
your SAS Support Consultant.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.