Working storage variables persisting after class finalized in native code

A class had a method that used WORKING-STORAGE instead of LOCAL-STORAGE.  I created in instance of the class and set a variable in WORKING-STORAGE to a value, then finalized the instance.  I then created a new instance of the class and called the method.  The value from the last instance carried over into the new instance.  Is this expected behavior ?  It behaves the same way in Visual COBOL and Net Express 5.1.

I fixed this by using LOCAL-STORAGE instead of WORKING-STORAGE.

Parents
  • It depends where the variable is defined.  If it's defined in the STATIC area of the class (or the definition includes the STATIC keyword), then it would be expected to be the same for all instances of the class.  If on the other hand it's defined in the OBJECT area, then it should be distinct for each instance.

Reply
  • It depends where the variable is defined.  If it's defined in the STATIC area of the class (or the definition includes the STATIC keyword), then it would be expected to be the same for all instances of the class.  If on the other hand it's defined in the OBJECT area, then it should be distinct for each instance.

Children
No Data