FDELETE Function: z/OS

Deletes an external file or an empty directory.
Category: External Files
z/OS specifics: fileref
See: FDELETE Function in SAS Functions and CALL Routines: Reference

Syntax

FDELETE (fileref)

Required Argument

fileref
identifies an external file. If fileref is a literal fileref name, it must be in quotation marks. If fileref is the name of a character variable whose value is a fileref name, it must not be quoted. The fileref must have been previously associated with a sequential file, a PDS, a PDSE, or a UNIX System Services file using a FILENAME statement or FILENAME function. The fileref cannot represent a concatenation of multiple files.

Details

FDELETE returns 0 if the operation was successful, or a nonzero number if it was not successful. If the fileref that is specified with FDELETE is associated with a UNIX System Services directory, PDS, or PDSE, then that directory, PDS, or PDSE must be empty. In order to delete the directory or file, the user that calls FDELETE must also have the appropriate privileges.

Example: Examples

Example of a literal fileref:
filename delfile 'myfile.test';
  data _null_;
  rc=fdelete('delfile');
  run;
Example of a variable whose value is a fileref name:
data _null_;
delref = 'delfile';
rc = fdelete(delref);
run;