Guardian Programmer's Guide

Table Of Contents
Communicating With Disk Files
Guardian Programmer’s Guide 421922-014
5 - 14
Purging Unstructured Files
Purging Unstructured Files
You purge an unstructured file the same way you would purge any file; either
interactively using the FUP PURGE command or TACL PURGE command, or
programmatically by calling the FILE_PURGE_ procedure. Purging does not normally
delete the data, but it changes pointers to show the file to be absent and its extent
space deallocated.
The file should be closed before you attempt to purge it.
You can force the FILE_PURGE_ procedure to clear the file of all data by setting the
CLEARONPURGE flag. You may want to do this for security reasons; otherwise the
extents that the purged file occupied do become readable when reallocated to another
file. Use function 1 of the SETMODE procedure to set the CLEARONPURGE flag
(bit 1) to 1.
The following example purges a file and clears all its data:
LITERAL SET^SECURITY = 1,
CLEAR^ON^PURGE = %40000;
INT OLD^VALUES[0:1];
.
.
!Save current security flag values
CALL SETMODE(FILE^NUM,
SET^SECURITY,
!param^1!,
!param^2!,
OLD^VALUES);
!Set CLEARONPURGE and merge with existing security flag
!values:
CALL SETMODE(FILE^NUM,
SET^SECURITY,
(CLEAR^ON^PURGE LOR OLD^VALUES[0]));
IF <> THEN ...
.
.
ERROR := FILE^CLOSE(FILE^NUM);
IF ERROR <> THEN ...
.
.
NAME ':=' "\SYS.$ADMIN.OPERTOR.LOGFILE1" -> @S^PTR;
NAME^LENGTH := @S^PTR '-' @NAME;
ERROR := FILE_PURGE_(NAME:NAME^LENGTH);
IF ERROR <> 0 THEN ...
Common reasons for an error to be returned are that some other process has the file
open, the owner does not permit this process to purge the file, or the file is a TMF audit
file. The Transaction Management Facility subsystem (TMF) is the main functional
component of NonStop TM/MP.