Skip to main content

DOTNET to Acucobol: how to stop acugt.exe

  • May 16, 2011
  • 6 replies
  • 0 views

[Migrated content. Thread originally posted on 15 May 2011]

We are using Windows XP SP3, Acucobol 8.1.2 and are developing an application where c# (asp, mvc3, framework 4) calls the Cobol programme.
This works OK, except that the acugt.exe which is startted by the c# programme never stops.
So if we call a Cobol programme five times, the task manager shows five instances of acugt.exe

Here is the part of the programme that calls Acucobol:

object acuParameters = "-c c:\\\\ad\\\\bin\\\\sveainfo.cfg";
object __PLACEHOLDER__ = null;
object parameters = (string)parameterString;

AcuGTObjects.AcuGTClass AcugtInterface = new AcuGTObjects.AcuGTClass();

try
{
AcugtInterface.Initialize(ref acuParameters);
AcugtInterface.Call(
ref programName,
ref parameters,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__);
}
catch (Exception ex)
{
return ex.Message;
}
finally
{
AcugtInterface.Shutdown();
}


Can someone give advice, please?

6 replies

[Migrated content. Thread originally posted on 15 May 2011]

We are using Windows XP SP3, Acucobol 8.1.2 and are developing an application where c# (asp, mvc3, framework 4) calls the Cobol programme.
This works OK, except that the acugt.exe which is startted by the c# programme never stops.
So if we call a Cobol programme five times, the task manager shows five instances of acugt.exe

Here is the part of the programme that calls Acucobol:

object acuParameters = "-c c:\\\\ad\\\\bin\\\\sveainfo.cfg";
object __PLACEHOLDER__ = null;
object parameters = (string)parameterString;

AcuGTObjects.AcuGTClass AcugtInterface = new AcuGTObjects.AcuGTClass();

try
{
AcugtInterface.Initialize(ref acuParameters);
AcugtInterface.Call(
ref programName,
ref parameters,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__);
}
catch (Exception ex)
{
return ex.Message;
}
finally
{
AcugtInterface.Shutdown();
}


Can someone give advice, please?
Just and idea: Did you try cancelling the called program before shutting down the runtime?

Paul

[Migrated content. Thread originally posted on 15 May 2011]

We are using Windows XP SP3, Acucobol 8.1.2 and are developing an application where c# (asp, mvc3, framework 4) calls the Cobol programme.
This works OK, except that the acugt.exe which is startted by the c# programme never stops.
So if we call a Cobol programme five times, the task manager shows five instances of acugt.exe

Here is the part of the programme that calls Acucobol:

object acuParameters = "-c c:\\\\ad\\\\bin\\\\sveainfo.cfg";
object __PLACEHOLDER__ = null;
object parameters = (string)parameterString;

AcuGTObjects.AcuGTClass AcugtInterface = new AcuGTObjects.AcuGTClass();

try
{
AcugtInterface.Initialize(ref acuParameters);
AcugtInterface.Call(
ref programName,
ref parameters,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__);
}
catch (Exception ex)
{
return ex.Message;
}
finally
{
AcugtInterface.Shutdown();
}


Can someone give advice, please?
There is one main cobol programme which calls various others.
The others are cancelled by the main programme.
Is there a way to get the main programme to cancel itself? We have tried "EXIT PROGRAM" and "STOP RUN".

Stephen Hjerpe
  • Participating Frequently
  • May 18, 2011

[Migrated content. Thread originally posted on 15 May 2011]

We are using Windows XP SP3, Acucobol 8.1.2 and are developing an application where c# (asp, mvc3, framework 4) calls the Cobol programme.
This works OK, except that the acugt.exe which is startted by the c# programme never stops.
So if we call a Cobol programme five times, the task manager shows five instances of acugt.exe

Here is the part of the programme that calls Acucobol:

object acuParameters = "-c c:\\\\ad\\\\bin\\\\sveainfo.cfg";
object __PLACEHOLDER__ = null;
object parameters = (string)parameterString;

AcuGTObjects.AcuGTClass AcugtInterface = new AcuGTObjects.AcuGTClass();

try
{
AcugtInterface.Initialize(ref acuParameters);
AcugtInterface.Call(
ref programName,
ref parameters,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__);
}
catch (Exception ex)
{
return ex.Message;
}
finally
{
AcugtInterface.Shutdown();
}


Can someone give advice, please?
Have you tried the shutdown option:

shutdown() Shuts down the CVM

Chapter 2: Working with Java Technology > 2.2 Calling COBOL from Java > 2.2.3 Using the Java API, "CVM.jar" >

2.2.3.1 CVM class


[Migrated content. Thread originally posted on 15 May 2011]

We are using Windows XP SP3, Acucobol 8.1.2 and are developing an application where c# (asp, mvc3, framework 4) calls the Cobol programme.
This works OK, except that the acugt.exe which is startted by the c# programme never stops.
So if we call a Cobol programme five times, the task manager shows five instances of acugt.exe

Here is the part of the programme that calls Acucobol:

object acuParameters = "-c c:\\\\ad\\\\bin\\\\sveainfo.cfg";
object __PLACEHOLDER__ = null;
object parameters = (string)parameterString;

AcuGTObjects.AcuGTClass AcugtInterface = new AcuGTObjects.AcuGTClass();

try
{
AcugtInterface.Initialize(ref acuParameters);
AcugtInterface.Call(
ref programName,
ref parameters,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__);
}
catch (Exception ex)
{
return ex.Message;
}
finally
{
AcugtInterface.Shutdown();
}


Can someone give advice, please?
To shjerpe

We are already doing this here:
AcugtInterface.Shutdown()

or is there another shutdown?


[Migrated content. Thread originally posted on 15 May 2011]

We are using Windows XP SP3, Acucobol 8.1.2 and are developing an application where c# (asp, mvc3, framework 4) calls the Cobol programme.
This works OK, except that the acugt.exe which is startted by the c# programme never stops.
So if we call a Cobol programme five times, the task manager shows five instances of acugt.exe

Here is the part of the programme that calls Acucobol:

object acuParameters = "-c c:\\\\ad\\\\bin\\\\sveainfo.cfg";
object __PLACEHOLDER__ = null;
object parameters = (string)parameterString;

AcuGTObjects.AcuGTClass AcugtInterface = new AcuGTObjects.AcuGTClass();

try
{
AcugtInterface.Initialize(ref acuParameters);
AcugtInterface.Call(
ref programName,
ref parameters,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__);
}
catch (Exception ex)
{
return ex.Message;
}
finally
{
AcugtInterface.Shutdown();
}


Can someone give advice, please?
To shjerpe

We are already doing this here:
AcugtInterface.Shutdown()

or is there another shutdown?


[Migrated content. Thread originally posted on 15 May 2011]

We are using Windows XP SP3, Acucobol 8.1.2 and are developing an application where c# (asp, mvc3, framework 4) calls the Cobol programme.
This works OK, except that the acugt.exe which is startted by the c# programme never stops.
So if we call a Cobol programme five times, the task manager shows five instances of acugt.exe

Here is the part of the programme that calls Acucobol:

object acuParameters = "-c c:\\\\ad\\\\bin\\\\sveainfo.cfg";
object __PLACEHOLDER__ = null;
object parameters = (string)parameterString;

AcuGTObjects.AcuGTClass AcugtInterface = new AcuGTObjects.AcuGTClass();

try
{
AcugtInterface.Initialize(ref acuParameters);
AcugtInterface.Call(
ref programName,
ref parameters,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__,
ref __PLACEHOLDER__);
}
catch (Exception ex)
{
return ex.Message;
}
finally
{
AcugtInterface.Shutdown();
}


Can someone give advice, please?
I am using wrunnet.dll to call cobol from .net, and haven't had any issues with the runtime, or any other issues for that matter. It works very well.

I located a code sample on the old forum, and it helped me to get things setup and running. Here is the C# code sample, and if you have any questions, let me know.


using System;
using acucobol; // this namespace is in wrunnet.dll. Added in references (Add reference)

namespace NetSample
{
    public class NetSample
    {
     public CVM acuCobol;

     public NetSample() // constructor
     {
        // Instantiate the Cobol Virtual Machine Class
        // See Object Browser wrunnet, namespace acucobol, class CVM
        acuCobol = new CVM();     
     }

     // Set Acucobol Runtime Properties and call Initialize
     public bool InitAcuCobol(string RuntimeParams)
     {
     // You can set runtime options using properties and or a string
     // containing runtime command line options.
     // You can mix both types, parameter string and properties.
     // If you use only properties you can call Initialize without
     // a parameter string. acuCobol.Initialize();

        acuCobol.ListConfig = true;
        acuCobol.Debug = true;
        acuCobol.ErrorsOut = "c:\\\\temp\\\\error.log";

        acuCobol.Initialize(RuntimeParams);
        return true;
     }
     // execute an Acucobol program
     public bool ExecuteCobolPgm(string PgmName )
     {
        // This holds parameters for cobol linkage section and entry params
        // See Documentation
        object [] paramObjects = null;

        // See Documentation
        byte [] cblTypes = null;

        // See Documentation or Onject Browser for values
        acucobol.errorTypes rtn;

        int CobolReturnCode = 0;

        rtn = acuCobol.Call(PgmName,
         ref paramObjects,
         ref cblTypes,
         null,
         ref CobolReturnCode);
        return true;
     }
     // Stop the runtime
     public bool StopAcuCobol()
     {
        acuCobol.ShutDown( 0 );
        return true;
     }
    }
}


The main thing you have to do is setup the paramObjects to hold your linkage items. I just use string items because they are easy to work with. Make sure each string within the objects array matches the size of the 01 item in the linkage area.

You can also setup a path to your config file and your runtime using:
acuCobol.ConfigFile = @"\\\\server\\path_to_config\\config.cfg";
acuCobol.RunPath = @"\\\\server\\path_to_runtime\\bin";


Do this before calling acuCobol.Initialize