Skip to main content

I was wondering if there were any side effects of setting the configuration variable CLOSE_ON_EXIT to a 1.  We have come upon some situations where developers have forgotten to close files opened in their programs.  I cannot find what issues could arise using this option only a place in the docs that indicate that it is not ANSI compliant and, therefore, not the default when using runcbl.

I think that another option that I would prefer is to inquire of some way to log when a program exits with files that are open still so that the programs can be fixed.  Is that possible?

I was wondering if there were any side effects of setting the configuration variable CLOSE_ON_EXIT to a 1.  We have come upon some situations where developers have forgotten to close files opened in their programs.  I cannot find what issues could arise using this option only a place in the docs that indicate that it is not ANSI compliant and, therefore, not the default when using runcbl.

I think that another option that I would prefer is to inquire of some way to log when a program exits with files that are open still so that the programs can be fixed.  Is that possible?

Setting CLOSE_ON_EXIT to 1 will cause all non-print files to be closed upon EXIT PROGRAM.  That's the effect.  Are there also side effects?  I'm not sure.  It could be that if a file were shared by more than one program (EXTERNAL?) you would not want the EXIT of program A to close the file that is still in use by program B.  

An option to dump a list of still-open files when a program exits sounds like a useful enhancement request.


I was wondering if there were any side effects of setting the configuration variable CLOSE_ON_EXIT to a 1.  We have come upon some situations where developers have forgotten to close files opened in their programs.  I cannot find what issues could arise using this option only a place in the docs that indicate that it is not ANSI compliant and, therefore, not the default when using runcbl.

I think that another option that I would prefer is to inquire of some way to log when a program exits with files that are open still so that the programs can be fixed.  Is that possible?

Thank you, @shjerpe.  I do not like the idea of auto-magically closing files on exit.  I am just running into a few isolated incidents where previous developers have not cleaned up their messes.  Should I go through support to request that enhancement?


I was wondering if there were any side effects of setting the configuration variable CLOSE_ON_EXIT to a 1.  We have come upon some situations where developers have forgotten to close files opened in their programs.  I cannot find what issues could arise using this option only a place in the docs that indicate that it is not ANSI compliant and, therefore, not the default when using runcbl.

I think that another option that I would prefer is to inquire of some way to log when a program exits with files that are open still so that the programs can be fixed.  Is that possible?

Yes, please contact Customer Care to raise an enhancement request.