ERASE
ANSI
The ERASE instruction deletes a file from the disk. The instruction uses the following format:
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
filename
Required. A previously defined Character String Variable or Literal indicating the name of the file that is deleted.
Flags Affected: OVER
Note the following:
{filename} is required to specify the file name that is deleted. The Logical String is used.
The OVER flag is set if the file does not exist or cannot be erased because another task has the file open.
ERASE performs the same function as a PREP/CLOSE but does it in a single, more efficient step.
Under PLBCMP, if a file name starts with a '$' character, it is scanned to the first non-alpha non-numeric character. The environment table is then searched for this entry. If a matching entry is found, the string associated with the entry is substituted within the file name. An entire file name may be substituted in this manner, or all or a portion of a file path may be specified in this manner.
If the {filename} has a vertical bar (|) and an IP number or host name appended, the operation is redirected to the SUNDM data manager.
When using SQLIO, ERASE looks in the Sun_Sqlio_File and the Sun_Sqlio_Ifile system tables for a name match. If found in the Sun_Sqlio_File table, the associated table will be dropped. If found in the Sun_Sqlio_Ifile table, the associated index will be dropped.
A Datapoint style filename of `filename/ext:drv' is converted to a Sunbelt format as follows:
If an extension is found, the '/' extension delimiter is now changed to a Sunbelt extension delimiter character defined in the screen definition file used by the runtimes. The default extension delimiter would replace the '/' delimiter with a period .
The ':drv' specification in a Datapoint filename is changed to a substituted string
defined by a UET keyword that must be defined by appending the Datapoint drive identification string to
'PLBVOL_'. In the above case the UET string must be defined as 'PLBVOL_DRV={path}' in the environment
table or in the 'PLBWIN.INI' file. If the UET keyword is not found, the runtime attempts to open the
file with no changes. However, if the UET keyword is found, the runtime changes the filename to '{path}\filename.ext'.
Example: UET has environment entry defined as PLBVOL_D1=c:\data
ERASE
"name/txt:D1"
Actual file erased: c:\data\name.txt
See Also: Example Code, RENAME, Disk I/O Instructions
![]() |