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 was defined in WORKING-STORAGE of a method that was not static.  I normally use LOCAL-STORAGE instead of WORKING-STORAGE for my methods.  My actual fix was to define the variable in OBJECT-STORAGE because it was a counter I incremented each time I called the method.

Reply
  • It was defined in WORKING-STORAGE of a method that was not static.  I normally use LOCAL-STORAGE instead of WORKING-STORAGE for my methods.  My actual fix was to define the variable in OBJECT-STORAGE because it was a counter I incremented each time I called the method.

Children
No Data