COBOL Manual for TNS/E Programs (H06.03+)
Disk Input and Output
HP COBOL Manual for TNS/E Programs—520347-003
28-43
Purging the Contents of a File From an HP COBOL
Program
If the reason you want to purge a file is that you want to have a temporary file for the
duration of a single process and the name of the file is not of any real interest, use the
special name #TEMP in the ASSIGN clause of the file-control entry at compilation time
(or in a TACL ASSIGN command at execution time). When you specify #TEMP, the
run-time routines create a temporary file on the process’s default volume.
You can also create a temporary file on a specific volume by just assigning the
HP COBOL file to the volume name, specifying spaces. It is often useful to locate a
temporary file on a different volume to improve performance.
The TACL ASSIGN command enables you to allocate specific primary and secondary
extents for temporary and permanent disk files that a process is to create. If you do not
specify extents, the run-time routines use a primary extent size of 4 disk pages (each
page holds 2048 bytes) and a secondary extent size of 20 disk pages.
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.
PROCEDURE DIVISION.
...
MOVE "$FIFTY.NIFTY.SHIFTY" TO EXTERNAL-NAME.
MOVE "$FIFTY" TO VOL-NAME.
MOVE "NIFTY" TO SUBVOL-NAME.
MOVE "SHIFTY" TO FILE-NAME.
ENTER "FILE_PURGE_" USING EXTERNAL-NAME (1:19)
GIVING FS-ERROR.
ENTER TAL "COBOLFILEINFO" USING INTERNAL-NAME PURGE-RESULT
IF PURGED-OK
...
Example 28-13. Purging a File From an HP COBOL Program (page 2 of 2)










