z/OS Language Environment Writing Interlanguage Communication Applications
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Name scope of external data

z/OS Language Environment Writing Interlanguage Communication Applications
SA38-0684-00

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 static external data for PL/I and static variables defined outside of any function for C is the load module. If your application contains PL/I procedures and non-reentrant C routines, PL/I's external data maps to C's external data only within a load module. After you cross a load module boundary, external data does not map. In addition, the external data does not map if any C function in the application is compiled with the XL C RENT compile-time option.

Figure 1 illustrates the name scope of external variables in a PL/I to C enclave, if the C function is non-reentrant. The routine can be a PL/I procedure or C routine. If Routine 3 is a PL/I procedure, however, it cannot have any variables with the EXTERNAL attribute; therefore, the name scope of Routine 3 in the figure refers only to C routines.

Figure 1. Name scope of external variables for PL/I or C fetch

name scope of external variables for or fetch

In Figure 1, external data declared in Routine 1 maps to that declared in Routine 2 in the same load module. If the fetch is made to a C Routine 3 in another load module is made, the external data does not map, because the name scope of external data in C is the load module. If the fetch is made to a PL/I Routine 3, the routine is not allowed to have any variables declared with the EXTERNAL attribute.

When the name scopes of PL/I and C are the same, do not give external data the same name in a PL/I to C application if you cross a load module boundary.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014