Highlighted
Absent Member.
Absent Member.
510 views

[archive] Threads and screens

[Migrated content. Thread originally posted on 02 February 2004]

Am I misunderstanding the way threads work?

Here is something I tried and it didn't work the way I expected.

I have an initial graphical window displayed and in it I display a 01 level screen section entry containing graphical controls.

When a button is clicked, I execute a PERFORM IN THREAD to create a new thread.

In running in the new thread, I display a modeless floating window with BIND TO THREAD specified. Then in that thread, I display the same 01 level screen section entry I displayed in the initial window, which I want to appear in the new window. But it doesn't - it redisplays in the initial window. I also tried using DISPLAY .. UPON using the window handle of the second window and that did not work.

From that, is it correct that I cannot display/accept the same screen section entry in multiple windows in the same program?
0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

RE: [archive] Threads and screens

Correct, if you have a screen section item ABC in the same program, you cannot display this twice within the same program even though you execute a paragraph or a section in separate threads. This because the COBOL language has no mechanism for thread safe variables.

This is however using the approach you've chosen. If you separate out the screen section part into an individual application, you can call this application like:

call IN THREAD "mysubprog" HANDLE in mythreadhandle.

And then, inside this, you allocate your sub window and do a DISPLAY screenitem UPON mysubwindow, you should be able to do what you want.
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.