Skip to main content

Forcing exit with no cleanup from a Windows COBOL application

  • February 15, 2013
  • 1 reply
  • 0 views

This article explains how to use the TerminateProcess to stop a process with no cleanup.

Problem:

What can you do if an application needs to exit immediately with no cleanup in order to prevent some issues at process closedown in third party components?

Resolution:

You can use the TerminateProcess to stop a process with no cleanup. However this means that the COBOL runtime will not be able to perform any cleanup. If you issue TerminateProcess on a COBOL process then it could lead to issues such as corrupt files as normal clean up is not performed.

Note: This code should only be used with care. Attached is an example of this API being called from COBOL.

Incident Number: 2267166

Old KB# 14572

1 reply

  • Author
  • Rocketeer
  • 19312 replies
  • February 22, 2018

This article explains how to use the TerminateProcess to stop a process with no cleanup.

Problem:

What can you do if an application needs to exit immediately with no cleanup in order to prevent some issues at process closedown in third party components?

Resolution:

You can use the TerminateProcess to stop a process with no cleanup. However this means that the COBOL runtime will not be able to perform any cleanup. If you issue TerminateProcess on a COBOL process then it could lead to issues such as corrupt files as normal clean up is not performed.

Note: This code should only be used with care. Attached is an example of this API being called from COBOL.

Incident Number: 2267166

Old KB# 14572

where is the example?