In the program that created it, a thread and its parent thread share the same data. This includes both working-storage and files (including the file's open state and record position). Thus any changes made in one thread will be seen by the other thread. The only data that are not shared are those items internally generated by the compiler that are related to the flow of control within a thread, such as a paragraph's return address or an internal counter associated with PERFORM N TIMES.
When a thread CALLs a program, any data local to that program are private to that thread (and its child threads). As a result, you can write utility routines that many threads can call, without having to worry about data sharing issues in the utility. Note that any data passed (BY REFERENCE) to the called program are shared if they are shared in the program passing the data.
External data items and external files are always shared by all threads.
ACUCOBOL-GT ensures that any one logical operation on a data item is fully completed before control switches between threads. Consider the following example:
77 DATA-1 PIC X(3). PERFORM THREAD MOVE "ABC" TO DATA-1 END-PERFORM MOVE "DEF" TO DATA-1 WAIT FOR LAST THREAD DISPLAY DATA-1
The last DISPLAY will either print ABC or DEF depending on the order in which the threads execute. It will not, however, print something like AEF or DEC because each MOVE that affects DATA-1 is performed in its entirety before control switches between threads.