Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Migration Guide

Uninitialized EXTERNAL STATIC

Under the old compiler, a variable declared as EXTERNAL STATIC but with no INITIAL value(s) specified for it was not allocated any storage (and a linkage editor ESD of type CM was issued). The storage for it must have been defined in some other program object that will be linked with it. In fact, the storage that was actually allocated may be bigger than what its declare specified (or implied). For example, consider the following code declares

dcl testpcl ext static, pcl char(16) based(addr(testpcl));

The variable testpcl has the (implied) attributes of FLOAT DEC(6) and hence would seem to be allocated only 4 bytes of storage. If all the programs linked with this one also declare testpcl with the same PL/I declare, then exactly 4 bytes will be allocated to it. However, if it is linked with, say, an assembler that defined testpcl as a 16-byte CSECT, then the linker would allocate 16 bytes to it.

The new compiler will currently allocate 4 bytes to such a variable (and issue a linkage editor ESD of type SD and length 4). An attempt to use it as the base for, say, a 16-byte area will lead to errors.

If you want to declare a variable but have its storage allocation be determined by its declaration in another module, you should declare it with the RESERVED option. For example, the declare above should be:

dcl testpcl ext static reserved, pcl char(16) based(addr(testpcl));

If, however, you compile with the option COMMON, then the Enterprise compiler will also issue a linkage editor ESD of type CM, and the code would work as it did with the old compiler.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)