Enscribe Programmer's Guide
None of these actually physically erases data. Instead, they all reset various pointers to indicate
that either:
• The file no longer exists (FUP PURGE command or the FILE_PURGE_ system procedure)
• The file exists but contains no data (FUP PURGEDATA command or CONTROL 20 system
procedure)
In the first case, if the file space is subsequently reallocated to another file, the new file's owner
can read the logically purged data. For security reasons, you might want to avoid this. You can
do so by enabling the CLEARONPURGE option prior to purging the file. You enable
CLEARONPURGE by using either the SETMODE 1 system procedure or the FUP SECURE command.
Having done so, all of the data in the file is physically erased (overwritten with zeros) when the
file is purged. CLEARONPURGE has no effect in conjunction with the FUP PURGEDATA command.
For example, the TAL code resets the current-record, next-record, and EOF pointers of the particular
file to point to relative byte 0 and updates the EOF pointer in the file label on disk:
LITERAL purgedata = 20;
CALL CONTROL ( filenum, purgedata );
IF < THEN...
The file still exists, but it now logically contains no data.
You can also use the CONTROL 21 system procedure (allocate/ deallocate extents) in conjunction
with CONTROL 20 to logically purge a file's data and then deallocate all of its extents:
LITERAL purgedata = 20,
alloc^op = 21,
dealloc = 0;
CALL CONTROL ( filenum, purgedata );
IF < THEN ...
CALL CONTROL ( filenum, alloc^op, dealloc );
IF < THEN ...
The file still exists, but it now logically contains no data and all of its extents have been released
(deallocated).
CONTROL 21 can be used to deallocate extent space beyond the EOF even when the EOF points
to a relative byte greater than zero.
Programmatically Allocating File Extents
You can use the CONTROL 21 system procedure to allocate one or more file extents for an open
file. For example, to allocate 16 extents to a newly created file, open the file and then issue a
CONTROL 21 procedure call:
LITERAL alloc^op = 21,
max^ext = 16;
CALL CONTROL ( filenum, alloc^op, max^ext );
IF < THEN ...
NOTE: If all extents cannot be allocated because the file label is full, error 43 is returned.
Programmatically Deallocating File Extents
You can also use the CONTROL 21 system procedure to deallocate any file extents beyond the
extent to which the EOF pointer is currently pointing.
For example, to deallocate any unused extents in a file, open the file and then issue a CONTROL
21 procedure call:
LITERAL alloc^op = 21,
dealloc = 0;
CALL CONTROL ( filenum, alloc^op, dealloc );
The file still exists, but all file extents beyond the EOF extent are deallocated.
File Access 59