COBOL Manual for TNS and TNS/R Programs

Disk Input and Output
HP COBOL Manual for TNS and TNS/R Programs522555-006
28-44
Purging the Contents of a File From an HP COBOL
Program
Unless the CLEARONPURGE flag is set for a file, purging the file does not obliterate
the data on the disk. If security is a major consideration, use one of these to set the
CLEARONPURGE flag:
The FUP SECURE command with the CLEARONPURGE option
The SETMODE routine
For more information about the FILE_PURGE_ and SETMODE routines, see the
Guardian Procedure Calls Reference Manual.
Purging the Contents of a File From an HP COBOL Program
It is sometimes convenient to purge the contents of a file but keep the file in the
directory for later use. The HP COBOL run-time routines do this when you open a file
for output (if you have read access to the file). You might choose (for security) to purge
the contents of a temporary work file when you have finished working with it, because
merely purging the file does not erase the data from the disk.
The HP COBOL library routine COBOL_CONTROL_ is a multipurpose routine that
calls the operating system routine CONTROL, and whose function is determined by an
operation code. The operation code 20 enables a process to purge only the contents of
a file if the process has write access to the file. The process can even purge the data
from a temporary file whose name was assigned by Enscribe because you specified
only a volume name or assigned it to #TEMP.
The COBOL_CONTROL_ routine call for purging data requires two parameters. The
first parameter is the file-name described in the SELECT clause of the file-control
entry for the file; the second is the number 20 (which causes the file system to purge
the data in the file). Example:
ENTER "COBOL_CONTROL_" USING MYFILE 20
For more information about the CONTROL routine, see the Guardian Procedure Calls
Reference Manual.
Renaming a File From an HP COBOL Program
The FILE_RENAME_ procedure enables a process to rename a closed disk file,
provided the process has purge access to the file. If the file is a temporary file, the
process can call FILE_RENAME_ to make the file a permanent file. For more
information about the RENAME or FILE_RENAME_ routine, see the Guardian
Procedure Calls Reference Manual.