I have a requirement where I need to delete a file if a particular condition is met in the cobol program.
Now this may sound strange to you, but thats how the requirement is.
I have never deleted a file using COBOL, JCL is the one that is supposed to handle such requests.
I have one solution in my mind, that is to set RETURN-CODE register in the COBOL program to some value lets say 55 when the condition to delete is met
in the cobol program and in the subsequent step in JCL, I will delete the file using IEFBR14 if the RC is 55.
I hope this would work, I am looking for some alternate solutions to this problem.