COBOL Manual for TNS/E Programs (H06.03+)
Disk Input and Output
HP COBOL Manual for TNS/E Programs—520347-003
28-42
Purging a File From an HP COBOL Program
To enable your HP COBOL program to detect that two of its HP COBOL file names
refer to the same external file, call operating system routine FILENAME_COMPARE_.
FILENAME_COMPARE_ accepts two file names in internal form and returns a numeric
value:
A negative value other than -1 represents a file-system error number having the
corresponding positive value; for example, if at least one of the parameters specifies
an illegal file name, the value returned is -13.
For more information about the FILENAME_COMPARE_ routine, see the Guardian
Procedure Calls Reference Manual.
Purging a File From an HP COBOL Program
The HP COBOL language provides no mechanism for deleting a file from the system
directory; an HP COBOL program can purge a file only through an explicit call to the
FILE_PURGE_ procedure. The file being purged must be closed.
The FILE_PURGE_ procedure accepts the internal form of a file name as a parameter.
To determine whether the purge operation was successful, call the HP COBOL routine
COBOLFILEINFO with the file name as its parameter. COBOLFILEINFO returns an
error value. If the purge operation was successful, the error value is zero.
One common reason for a purge operation to fail is that the process’s accessor ID was
not authorized to purge the file according to the security attributes of the file.
Value
Returned Meaning
-1 The two internal file names do not refer to the same physical file.
0 The two internal file names refer to the same physical file.
1 The two internal file names refer to the same volume name, device name, or
process name, but the remainder of the two file names do not match (such as
two instances of the same spooler collector that specify different locations).
Example 28-13. Purging a File From an HP COBOL Program (page 1 of 2)
WORKING-STORAGE SECTION.
01 FS-ERROR NATIVE-2
01 EXTERNAL-NAME PIC X(30).
01 INTERNAL-NAME.
03 VOL-NAME PIC X(8).
03 SUBVOL-NAME PIC X(8).
03 FILE-NAME PIC X(8).
01 PURGE-RESULT PIC S9(4) COMP.
88 PURGED-OK VALUE ZERO.
...










