I am referring here to Linkage Section items that are not specified in the Procedure Division Using statement, but instead have linkage established by using the SET statement.
My observation is that upon entry to a called subroutine for a second time the linkage that was established the first time through is still in place. Is this intentional behavior, or just "coincidental"? And is there a possibility that an RFE would be acceptable to provide alternate behavior?
It seems to me that the COBOL "BASED" clause (from the COBOL 2002 standard) might be useful here. Rather than placing the field in the Linkage Section, one could place it in either the Working-Storage Section or Local-Storage Section, depending on the desired behavior. When in working-storage one would get the existing behavior ("static linkage", as it were). When in local-storage, upon entry to the subroutine there would be no addressability. That is, the address of the field would be NULL.
If the BASED clause is too much of an ask, perhaps some other way to set the later behavior. I think Micro Focus provides an option they call "sticky-linkage", where the latter option is default, but the current Enterprise COBOL behavior can be turned on.
Thoughts?
------------------------------
Frank Swarbrick
------------------------------