Highlighted
Absent Member.
Absent Member.
1259 views

[archive] Running Cobol Objects as Windows Services

[Migrated content. Thread originally posted on 25 February 2003]

With our application we have many interfaces that must run on the server to connect Cal accounting systems, movie systems, phone systems and many others. For years we place the applications in the startup folder and have them run when the machine boots. However this is not the best way especially if the server is the computer running the interfaces.

So we have been looking for an application that will run ANY program "including a batch file....since we would need a command string for cobol" to run as a windows service.

I have found one application called "service Mill" but it's a little pricey.

any ideas.
0 Likes
4 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Running Cobol Objects as Windows Services

Have you considered AcuGT Automation server?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Running Cobol Objects as Windows Services

we have used the automation server to exchange data back and forth from cobol to VB but that is the extent of my experiance with it. How would it help us in registering a cobol program as a windows service.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Running Cobol Objects as Windows Services

I just wanted to mention it in case you hadn't considered it, obviously when you have used it, I would believe it is considered.
My thought then was that whatever was requesting the "service" services, could just invoke the automation server upon need.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Running Cobol Objects as Windows Services

I think I understand what you are trying to do: you want a cobol app to start up and be controlled as a service. This is quite easy. All you need is a C compiler (MSVC is best). You should be able to find tutorials on how to create a service in C on the internet.


Start your program with the same command line you would use in a windows shortcut, using CreateProcess(). Make sure you keep priveleges to shutdown the app if necessary.
When the service stops, use TerminateProcess() to kill the cobol app. If you want to get fancy you could register a message or use tcp/ip to do some IPC for a graceful shutdown. Remember that services are not allowed to interact with the desktop by default.

I have tested this approach and can guarantee it will work. Things start to get complex if your service process needs to do a lot of messaging to the cobol app because they are in a different memory space, but you probably don't need that.

Merlin
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.