Created On:  29 November 2011


Main program has data items defined with the EXTERNAL clause as follows:

01  FIELD-1   PIC X(10)  EXTERNAL.

The main program calls a subprogram which has the same data item defined as EXTERNAL.
When the main program and subprogram are both .ints or .gnts then this works correctly.
When the main program is an .EXE and the subprogram is a .DLL then the EXTERNAL data items are not being shared.

The value of the data item in the subprogram is not the same value as the data item defined in the main program.  Why is this?


The problem is most likely that either the main program .EXE or the subprogram .DLL is being linked as static.  This causes the programs to each use their own copy of the COBOL run-time system and thus they each have their own copy of EXTERNAL data items.

When using EXTERNAL data items all modules must be linked to the Shared run-time system so that they share the same copy of EXTERNAL data items.  The problem does not occur when the modules are .int or .gnt because the run-time system is always shared for these executable types.
Incident #2545422