One key reason for having RESERVED is if you want to refer to an EXT STATIC variable defined in a C program which is linked with your code; in this case, the variable must be declared as RESERVED. The reverse is also true, if PL/I is the owner of a variable meant to be referenced in C program, then it must be RESERVED and there must be a PL/I PACKAGE that claims ownership of the variable with the RESERVES clause.
Using the RESERVED attribute says that a variable has one owner that the binder/linker uses to determines its size, etc. Without the RESERVED attribute, if an EXT STATIC variable is declared in more than one compilation unit, then the binder will choose one of those declares to determine its size (and woe to you if they don't match)
------------------------------
Peter Douxmont
------------------------------
Original Message:
Sent: Wed June 03, 2020 05:25 AM
From: Johannes Berger
Subject: PL/I - RESERVED vs EXTERNAL
What is the advantage of RESERVED over EXTERNAL? I understand the idea to relate an external variable to the package to which it logically belongs, but this relation is not visible for the users of the variable (only in the package itself), so I can't see an advantage here.
Is it something about DLLs (which I never used on the mainframe)?
------------------------------
Regards,
Johannes Berger
------------------------------