Highlighted
Respected Contributor.
Respected Contributor.
133 views

add a program to services

Jump to solution

Need help\documentation on how to add a program to services.This would automatically start when the server gets rebooted. Need the command line or how to submit it to services via task manager? Can a cobol program handle this or????

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: add a program to services

Jump to solution

Good morning.

It can be that the user-name under which the runtime is executed has not enough permissions to access this D:\ drive or its sub-folders.
Have you tried, just for a test, to use C:\ and see if things improve?

If it works accessing files and programs on C:\ then you have to check your user-name's permissions.

Unfortunately, there's no way to debug a program run in background.
What you can do is to track the runtime work in a log file.

Your program should be compiled for debugging (-ga),
then add the following variables to your CBLCONFI:

FILE_TRACE 9
FILE_TRACE_FLUSH 1
FILE_TRACE_TIMESTAMP 1
PARAGRAPH_TRACE 1

Modify your command-line adding the following option after wrun32.exe: -le C:\anExistingFolder\wrun32.log

At this point, you should have more information about what's processed and where the runtime hangs.

More details can be tracked in the log file by using customized DISPLAYs... UPON SYSERR.

You should add this line in your program file:

SPECIAL-NAMES. 
   SYSERR IS ERROR-LOG.

Then add DISPLAYs where necessary along your source code, especially where you think the runtime is hanging.

For example:

OPEN INPUT filename
DISPLAY "OPEN INPUT filename executed" UPON ERROR-LOG

OPEN OUTPUT filename2
DISPLAY "OPEN OUTPUT filename2 executed" UPON ERROR-LOG

etc.

At the end, these comments will be recorded in the wrun32.log file and you should be able to gather more information about the execution of your program.

Looking forward for your feedback.

----------------------------
Claudio Contardi
Product Support Engineer, Senior
Micro Focus

View solution in original post

0 Likes
4 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: add a program to services

Jump to solution

Good morning.

What Operating System you need to set this on?
Assuming it's Windows, you may find useful tutorials on-line.

For example:
How to Run Any Program as a Background Service in Windows

On the ACUCOBOL-GT side, you need to use a command-line that's composed by the runtime executable, the options you already use to launch your program and the program name.

For example:

wrun32.exe -c c:\etc\cblconfi <anyother options> MainBatchProgram.acu

Don't forget to set the wrun32.exe bin folder in the system PATH environment variable.
Alternatively, you can use the full path in the previous command-line:

"C:\Program Files (x86)\Micro Focus\extend 10.3.0\bin\wrun32.exe" -c c:\etc\cblconfi .....

As this program will be launched in background, you'll have to verify that the program does not contain any DISPLAY or ACCEPT statement.

Looking forward for your feedback.

----------------------------
Claudio Contardi
Product Support Engineer, Senior
Micro Focus
0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: add a program to services

Jump to solution
Is there any difference between a service or using the task scheduler?
I tried the task Scheduler but it gets hung up and just keeps running.
I have checked the program for displays and accept.
The only accept is for the Date and time.
As I check for a file that exists in a certain folder I am wondering if the return code is what is hanging this up?
Any thoughts?
Any debug available via task scheduler or services?
0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: add a program to services

Jump to solution

here is the batch job I am running in the task scheduler.

SET A_CONFIG C:\UNIACU\ETC\CBLCONFI

"C:\Program Files (x86)\Micro Focus\extend 10.3.0\AcuGT\bin\wrun32.exe" -un D:\PFIPRD\PVMEXEC\BARCALSV

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: add a program to services

Jump to solution

Good morning.

It can be that the user-name under which the runtime is executed has not enough permissions to access this D:\ drive or its sub-folders.
Have you tried, just for a test, to use C:\ and see if things improve?

If it works accessing files and programs on C:\ then you have to check your user-name's permissions.

Unfortunately, there's no way to debug a program run in background.
What you can do is to track the runtime work in a log file.

Your program should be compiled for debugging (-ga),
then add the following variables to your CBLCONFI:

FILE_TRACE 9
FILE_TRACE_FLUSH 1
FILE_TRACE_TIMESTAMP 1
PARAGRAPH_TRACE 1

Modify your command-line adding the following option after wrun32.exe: -le C:\anExistingFolder\wrun32.log

At this point, you should have more information about what's processed and where the runtime hangs.

More details can be tracked in the log file by using customized DISPLAYs... UPON SYSERR.

You should add this line in your program file:

SPECIAL-NAMES. 
   SYSERR IS ERROR-LOG.

Then add DISPLAYs where necessary along your source code, especially where you think the runtime is hanging.

For example:

OPEN INPUT filename
DISPLAY "OPEN INPUT filename executed" UPON ERROR-LOG

OPEN OUTPUT filename2
DISPLAY "OPEN OUTPUT filename2 executed" UPON ERROR-LOG

etc.

At the end, these comments will be recorded in the wrun32.log file and you should be able to gather more information about the execution of your program.

Looking forward for your feedback.

----------------------------
Claudio Contardi
Product Support Engineer, Senior
Micro Focus

View solution in original post

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.