This article addresses if a data file is used by a COBOL application, it is possible to remove it with UNIX rm command .
Problem:
With the UNIX command rm, you can delete a file that is used by a Micro Focus COBOL application. How can you verify the use of the data file before removing it?
Resolution:
The first solution is to create a script file with the Micro Focus wholock. The Micro Focus wholock command is put in $COBDIR/bin . This command displays the process that use the data file. The syntax is as follows:
$COBDIR/bin/wholock {name file}
Example :
$COBDIR/bin/wholock /home/user1/data/FIC1 displays :
Process 1232 (prog) on tty pts/2 holds 1 read and 1 write locks
An example of the script file ( wholock.sh ) is attached.
The second solution is to create a Language C program that verify the lock of the file and delete the file if it is possible. The Language C program is attached.
cc –o rmmf rmmf.c
rmmf { list of the data files}