Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
aw_muench Respected Contributor.
Respected Contributor.
902 views

Program running as long the runtime is active

Hi,

we are trying the following:

when the user starts a runtime we want the initial program A to call a little program B (as a thread) that runs independently as long as the runtime is running.

Even if for example program A calls program C with CALL PROGRAM.

 

Is this possible ? How would you achive this ?

The thread was our first idea. If you come up with something other than thread we are open for your solution.

0 Likes
5 Replies
ruudh
New Member.

RE: Program running as long the runtime is active

Hello,
indeed, the best way of doing this is using a thread.
You can find a sample in the Thread Demo sample (Source: custrpt.cbl)
Best regards,
Ruud
0 Likes
aw_muench Respected Contributor.
Respected Contributor.

RE: Program running as long the runtime is active

Thanks for your answer.

Are you sure the thread will continue after the calling program A has called another "main program" via CALL PROGRAM ?

Or do these rules apply:

The CALL PROGRAM verb is similar to the CHAIN verb. It causes the current run unit to terminate and initiates a new run unit.
When the called program exits, its thread is terminated.
0 Likes
ruudh
New Member.

RE: Program running as long the runtime is active

Hi,
when you use CALL THREAD "PROGRAM-B" program-b keeps running until it is terminated by the user or when the processing has finished, or until the main-program is terminated. We make sure of that by using STOP THREAD in the main-program. Program-b should have GOBACK instead of STOP RUN in it's closing routine.
Be aware that you not calling the main-program from program-b, because you will create a loop which will give unpredictable results.
0 Likes
DougP Outstanding Contributor.
Outstanding Contributor.

RE: Program running as long the runtime is active

For clarification 'CALL PROGRAM <program name>' and 'CALL <program name>' are two different operations. You can NOT use CALL PROGRAM for the scenario you are describing. Thread usage is only available with the CALL operation as described by ruudh.
0 Likes
aw_muench Respected Contributor.
Respected Contributor.

RE: Program running as long the runtime is active

Thanks DougP, that was exactly my state of knowledge ... unfortunately.

So we have to look for another solution to our problem.
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.