SAS Component Language Dictionary |
Deletes an external file
-
sysrc
-
contains the return code for the operation:
0 |
successful |
0 |
not successful |
Type:
Numeric
-
fileref
-
is the fileref that was assigned to the
external file to be deleted. The fileref cannot be associated with a list
of concatenated filenames or directories. If the fileref is associated with
a directory, a PDS or a PDSE, then the directory, PDS, or PDSE must be empty.
You must have permission to be able to delete the file or directory.
Type: Character
You can use either
the FILENAME statement or the FILENAME function in SCL to assign a fileref.
Under some operating environments, you can also use system commands to assign
filerefs.
Generate a fileref for an external file and assign it
to the variable FREF. Then call FDELETE to delete the file and call the FILENAME
function again to deassign the fileref.
length fref $ 8;
fref =_blank_;
/* Assign a fileref generated by the system */
/* to the physical filename that is stored */
/* in the variable FNAME. */
rc=filename(fref,fname);
if (rc=0) and (fexist(fref)) then
rc=fdelete(fref);
rc=filename(fref,'');
FEXIST
FILENAME
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.