Caché MultiValue Basic Reference
DELETESEQ
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Deletes a sequential file.
Synopsis
DELETESEQ filename [SETTING setvar] [LOCKED statements] 
[ON ERROR statements] [THEN statements] [ELSE statements]
Arguments
filename The file to be deleted. A fully-qualified Windows or UNIX® file pathname, specified as a quoted string. For two-part versions of this argument, see the Emulation section below.
SETTING setvar A variable used to hold the system return code. Because this comes from the underlying operating system, values are platform-dependent. However, all supported platforms return 0 for successful completion. The SETTING clause is executed before the ON ERROR, THEN, or ELSE clause.
Description
The DELETESEQ statement is used to delete a sequential access file.
The filename must be a fully-qualified pathname. The directories specified in filename must exist for a file delete to be successful. File names are not case-sensitive.
You can optionally specify a LOCKED clause, which is executed if DELETESEQ could not delete the specified sequential access file due to lock contention. The statements argument can be the NULL placeholder keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line; there must be a line break between the LOCKED keyword and the first line.
You can optionally specify an ON ERROR clause, which is executed if the file is located but could not be deleted. If no ON ERROR clause is present, the ELSE clause is taken for this type of error condition. The statements argument can be the NULL placeholder keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line; there must be a line break between the ON ERROR keyword and the first line.
You can optionally specify a THEN clause, an ELSE clause, or both a THEN and an ELSE clause. If the file delete is successful, the THEN clause is executed. If file delete fails (for example, the file does not exist), the ELSE clause is executed. The statements argument can be the NULL keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line and cannot follow a THEN, ELSE, or END keyword on that line.
You can use the STATUS function to determine the status of the sequential file delete operation, as follows: 0=success; 1=file does not exist; 2=path does not exist; 3=access denied; 4=the file is a directory; 5=the file is locked by another MV process; 6=the file is in use; -1=unexpected error; -2=delete failed for platform-dependent reason, see setvar for further explanation.
File Locking
Issuing OPENSEQ gives a process exclusive access to the specified file. An OPENSEQ locks the file against a DELETESEQ issued by any other process. This lock persists until the process that opened the file releases the lock, by issuing a CLOSE, a CLOSESEQ, or a RELEASE statement.
Emulation
For jBASE emulation, the filename argument can be specified with a two-part path,filename syntax. When executed, the two parts are concatenated together, with a delimiter added to the end of path, when necessary. For example, DELETESEQ 'c:\temp\','mytest.txt' or DELETESEQ 'c:\temp','mytest.txt'.
For other emulation modes, the filename argument can be specified with a two-part file,itemID syntax. The file part is a dir-type file defined in the VOC master dictionary, and the itemID part is an operating system file within that directory.
See Also