The RESERVED attribute implies STATIC EXTERNAL. Moreover, if a variable has the RESERVED attribute, then the application must comply with the following conditions:
If a variable has the RESERVED attribute, any INITIAL values are ignored except in the package reserving it.
|
If a compilation unit has a variable with the RESERVED attribute and is not the reserving package for that variable, then that compilation unit either must be part of the load module containing the reserving package or must import the variable from another load module containing the reserving package. In the latter case, the declaration must specify the IMPORTED option of the RESERVED attribute.
owns_x: package exports(*) reserves(x); dcl x char(256) reserved init( ... ); dcl y char(256) reserved init( ... ); dcl z char(256) reserved(imported) init( ... ); end; owns_y: package exports(*) reserves(y); dcl x char(256) reserved init( ... ); dcl y char(256) reserved init( ... ); dcl z char(256) reserved(imported) init( ... ); end; owns_z: package exports(*) reserves(z); dcl z char(256) reserved(imported) init( ... ); end;
In the preceding example, the package owns_x reserves and initializes the storage for the variable x. It must be linked into the same load module as the package owns_y. This load module must import the variable z from the load module into which package owns_z is linked.