DELET

Delete the specified file

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall DELET(filename)

Arguments

filename

An expression that contains a file specification. See File specifications for details on the format of a file specification. (a)

Discussion

The DELET subroutine locates and deletes the specified file. If the specified file does not exist, no error is generated. However, if the filename is null or blank, a “Bad filename” error ($ERR_FILSPC) occurs.

To delete an ISAM file, you must include the filename extension. Both the index and the related data file are deleted.

In previous versions of Synergy DBL, you could also specify a channel argument. This syntax is still valid, but the channel is ignored.

On OpenVMS, filename can contain wildcard characters. The default filename extension is .ddf. In addition, a given file can have more than one version. If filename does not explicitly specify the version number, all versions of that file are deleted.

Before deleting a file, make sure you first close any channels your program has open to that file.

If the file is open by your program or anyone else on the system when the program calls DELET, a “File in use by another user” error ($ERR_FINUSE) is generated.

Note

When issuing XCALL DELET from an application running on UNIX, you must have exclusive access to the file (no process, including the process issuing the DELET, may have the file open), and you must have write permission to both the file itself and the directory. This is more restrictive than what would be allowed from the UNIX command line, but it protects Synergy applications from prematurely deleting files that are in use, similar to the behavior on Windows and OpenVMS. If for some reason you need to override this safeguard, use XCALL SPAWN with the UNIX rm command to force the command line equivalent.

On Windows, because a virus scanner can take several seconds to scan a file, the DELET routine will retry for up to five seconds before reporting that a file is in use. (The default is 50 1/10th‑of‑a‑second retries, or 5 seconds. You can change the retry count by setting the RETRYTIME environment variable. See RETRYTIME.) The best way to avoid the wait time is to try to open the file exclusively first, so that an $ERR_FINUSE error will occur if the file is being used. This works only if the virus scanner is set to scan on CLOSE or WRITE. If the virus scanner instead performs a default scan of all files on OPEN, READ, and WRITE, an endless loop can occur.

Examples

literal
    file  ,a20,  "DP3:test01.xyz"
proc
    xcall delet(file)
    xcall delet("DM7:demox.tv")
    stop
end