The company I'm working at wants to apply multitasking for 3 programs.
i.e.
1. menu calls program A,
2. minimize program A, go back to menu and call program B
3. minimize program B, go back to menu and call program C
4. switch to any 3 opened programs at will
I found out from the guides that multithreading is the best solution for this. So, I tried this in the main menu, so that every called program has its own thread:
CALL THREAD PROG-WPATH HANDLE THREAD-1 USING PROG-ID, PROG-PARAMETER EXCEPTION STOP THREAD THREAD-1
And in the called program, I tried this:
DISPLAY INDEPENDENT WINDOW LINES 21 SIZE 112 CELL SIZE = ENTRY-FIELD FONT SEPARATE TITLE-BAR MODELESS NO SCROLL NO WRAP AUTO-MINIMIZE, TITLE S-WINDOW-TITLE BIND TO THREAD, HANDLE S-WINDOW. DISPLAY TOOL-BAR, LINES 2.2 BACKGROUND-LOW HANDLE S-TOOLBAR. DISPLAY FRAME AT 0102 LINES 20.7 CELL SIZE 110 RAISED.
I also changed STOP RUN to STOP THREAD.
As you can see in Capture.png, the thread is started but the debugger just exits after the CALL THREAD line and nothing happened. So I changed the thread via the debugger. The program opened but cannot read inputs and became stuck, so I had to close everything via the task manager.
Edit:
From https://www.microfocus.com/documentation/extend-acucobol/1000/BKUSUSPROGS066.html
To use this option you code your program in such a way that each modeless window runs in a separate thread, and you use the phrase LINK TO THREAD or BIND TO THREAD when you create each window. This phrase instructs the runtime to handle the CMD-ACTIVATE events on its own. In this arrangement, when a CMD-ACTIVATE event occurs, the runtime suspends the current thread and activates the new window.This is exactly what I did above, but I couldn't get it to work. Any advice would be helpful.