Name scope of external data

In programming languages, the name scope is defined as the portion of an application within which a particular declaration applies or is known. The name scope of external data differs between C++ and COBOL. The scope of external data under C++ is the load module; under COBOL, it is the enclave (or run unit). Figure 1 and Figure 1 illustrate these differences.

Because the name scope for C++ and COBOL is different, external variable mapping between C++ and COBOL routines is not supported. External variables with the same name are considered separate between C++ and COBOL.

If your application relies on the separation of external data, do not give the data the same name in both languages within a single application. If you give the data in each load module a different name you can change the language mix in the application later, and your application still behaves as you expect it to.