Skip to main content

Catch cobol program crashes when called from .NET

  • March 3, 2011
  • 9 replies
  • 0 views

[Migrated content. Thread originally posted on 02 March 2011]

Hi, i need to use the API given in the extend framework to call a cobol program from .NET. All it works fine, but if the cobol program crashes the .NET framework does too.

The project we are working on is very critical and we can not permit unexpected crashes of the whole system. Does it exist a way to catch the crash of the cobol program from c# .NET? Catching Exception doesn't work.

As an extreme solution, in C it is possible to specify custom handlers for system interrupts; is it possible something similar in the .NET context?

9 replies

[Migrated content. Thread originally posted on 02 March 2011]

Hi, i need to use the API given in the extend framework to call a cobol program from .NET. All it works fine, but if the cobol program crashes the .NET framework does too.

The project we are working on is very critical and we can not permit unexpected crashes of the whole system. Does it exist a way to catch the crash of the cobol program from c# .NET? Catching Exception doesn't work.

As an extreme solution, in C it is possible to specify custom handlers for system interrupts; is it possible something similar in the .NET context?
There is no way the .net framework can catch an exception in the runtime. You may however, try using the CBL_ERROR_PROC to inform the .net framework of an imminent shutdown.

[Migrated content. Thread originally posted on 02 March 2011]

Hi, i need to use the API given in the extend framework to call a cobol program from .NET. All it works fine, but if the cobol program crashes the .NET framework does too.

The project we are working on is very critical and we can not permit unexpected crashes of the whole system. Does it exist a way to catch the crash of the cobol program from c# .NET? Catching Exception doesn't work.

As an extreme solution, in C it is possible to specify custom handlers for system interrupts; is it possible something similar in the .NET context?
Ok, i tried with a combination of CBL_ERROR_PROC, in which i set an error code, and CBL_EXIT_PROC. Unfortunately the only way that i found to make the Extend run time to shut down without causing the .NET runtime to crash as well and making me able to recover the extend error code, is to use the "stop run" directive at the end of the custom EXIT_PROC (actually it is the only instruction). From the Acu doc, it is explicitly unrecommended to use the "stop run" directive into a custom exit procedure, due to undefined behaviour.

The question is, at first, do you know some better way to do what i need with CBL_EXIT_PROC and CBL_ERROR_PROC and if not, which are possible issues due to the undefined behaviour given from the "stop run" usage.

Thank you in advance

[Migrated content. Thread originally posted on 02 March 2011]

Hi, i need to use the API given in the extend framework to call a cobol program from .NET. All it works fine, but if the cobol program crashes the .NET framework does too.

The project we are working on is very critical and we can not permit unexpected crashes of the whole system. Does it exist a way to catch the crash of the cobol program from c# .NET? Catching Exception doesn't work.

As an extreme solution, in C it is possible to specify custom handlers for system interrupts; is it possible something similar in the .NET context?
Ok, i tried with a combination of CBL_ERROR_PROC, in which i set an error code, and CBL_EXIT_PROC. Unfortunately the only way that i found to make the Extend run time to shut down without causing the .NET runtime to crash as well and making me able to recover the extend error code, is to use the "stop run" directive at the end of the custom EXIT_PROC (actually it is the only instruction). From the Acu doc, it is explicitly unrecommended to use the "stop run" directive into a custom exit procedure, due to undefined behaviour.

The question is, at first, do you know some better way to do what i need with CBL_EXIT_PROC and CBL_ERROR_PROC and if not, which are possible issues due to the undefined behaviour given from the "stop run" usage.

Thank you in advance

[Migrated content. Thread originally posted on 02 March 2011]

Hi, i need to use the API given in the extend framework to call a cobol program from .NET. All it works fine, but if the cobol program crashes the .NET framework does too.

The project we are working on is very critical and we can not permit unexpected crashes of the whole system. Does it exist a way to catch the crash of the cobol program from c# .NET? Catching Exception doesn't work.

As an extreme solution, in C it is possible to specify custom handlers for system interrupts; is it possible something similar in the .NET context?
Ok, i tried with a combination of CBL_ERROR_PROC, in which i set an error code, and CBL_EXIT_PROC. Unfortunately the only way that i found to make the Extend run time to shut down without causing the .NET runtime to crash as well and making me able to recover the extend error code, is to use the "stop run" directive at the end of the custom EXIT_PROC (actually it is the only instruction). From the Acu doc, it is explicitly unrecommended to use the "stop run" directive into a custom exit procedure, due to undefined behaviour.

The question is, at first, do you know some better way to do what i need with CBL_EXIT_PROC and CBL_ERROR_PROC and if not, which are possible issues due to the undefined behaviour given from the "stop run" usage.

Thank you in advance

[Migrated content. Thread originally posted on 02 March 2011]

Hi, i need to use the API given in the extend framework to call a cobol program from .NET. All it works fine, but if the cobol program crashes the .NET framework does too.

The project we are working on is very critical and we can not permit unexpected crashes of the whole system. Does it exist a way to catch the crash of the cobol program from c# .NET? Catching Exception doesn't work.

As an extreme solution, in C it is possible to specify custom handlers for system interrupts; is it possible something similar in the .NET context?
Here is a quote from documentation:

[quote]An error procedure must end with an EXIT PROGRAM RETURNING statement which contains an appropriate return value. If the return value is zero, then subsequent error procedures are removed from the queue and are not called.

After all error procedures are called, the exit procedures, if any, are called. Then the run unit is terminated.[/
quote]

Based on this, I don't understand why you would have to do a STOP RUN?[/quote]

[Migrated content. Thread originally posted on 02 March 2011]

Hi, i need to use the API given in the extend framework to call a cobol program from .NET. All it works fine, but if the cobol program crashes the .NET framework does too.

The project we are working on is very critical and we can not permit unexpected crashes of the whole system. Does it exist a way to catch the crash of the cobol program from c# .NET? Catching Exception doesn't work.

As an extreme solution, in C it is possible to specify custom handlers for system interrupts; is it possible something similar in the .NET context?
I use the stop run into the custom exit procedure, not into the custom error procedure. I use the "exit program returning" in the error procedure to set the error code.

Any instruction other than the "stop run" ("exit program" as specified in acu doc or "goback giving") in the custom exit procedure causes the .NET to crash; if i don't specify a custom exit procedure .NET crashes as well. The only instruction that don't make .NET to crash is "stop run" into a custom exit procedure (CBL_EXIT_PROC).

To make the cobol program crash (as a test) i move a value into a not passed linkage item.

[Migrated content. Thread originally posted on 02 March 2011]

Hi, i need to use the API given in the extend framework to call a cobol program from .NET. All it works fine, but if the cobol program crashes the .NET framework does too.

The project we are working on is very critical and we can not permit unexpected crashes of the whole system. Does it exist a way to catch the crash of the cobol program from c# .NET? Catching Exception doesn't work.

As an extreme solution, in C it is possible to specify custom handlers for system interrupts; is it possible something similar in the .NET context?
Difficult to comment without any example. I suggest you try to come up with a minimal example and send this to Tech support so we can have a look at it.

[Migrated content. Thread originally posted on 02 March 2011]

Hi, i need to use the API given in the extend framework to call a cobol program from .NET. All it works fine, but if the cobol program crashes the .NET framework does too.

The project we are working on is very critical and we can not permit unexpected crashes of the whole system. Does it exist a way to catch the crash of the cobol program from c# .NET? Catching Exception doesn't work.

As an extreme solution, in C it is possible to specify custom handlers for system interrupts; is it possible something similar in the .NET context?
Difficult to comment without any example. I suggest you try to come up with a minimal example and send this to Tech support so we can have a look at it.

[Migrated content. Thread originally posted on 02 March 2011]

Hi, i need to use the API given in the extend framework to call a cobol program from .NET. All it works fine, but if the cobol program crashes the .NET framework does too.

The project we are working on is very critical and we can not permit unexpected crashes of the whole system. Does it exist a way to catch the crash of the cobol program from c# .NET? Catching Exception doesn't work.

As an extreme solution, in C it is possible to specify custom handlers for system interrupts; is it possible something similar in the .NET context?
Difficult to comment without any example. I suggest you try to come up with a minimal example and send this to Tech support so we can have a look at it.