Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: Working storage variables persisting after class finalized in native code

$
0
0

Morning,

The working-storage section is static and shared between all instances, so if you want the field to part of the object-storage and exist in each instance move the field into the "object-storage section".  For example:...

 $SET MFOO LINKCOUNT"1024" ooctrl"+p-f"

       CLASS-ID. Class1
                 INHERITS FROM AGROBASE
                 WITH DATA.

       OBJECT SECTION.
       CLASS-CONTROL.

           Class1      IS CLASS "Class1"
           AGROBASE    IS CLASS "AGROBASE"
           .

       WORKING-STORAGE SECTION.

       CLASS-OBJECT.                           *> Definition of the Class data and method
       OBJECT-STORAGE SECTION.
       END CLASS-OBJECT.

      ********************************************************************
       OBJECT.    *> Definition of instance data and methods
      ********************************************************************

       OBJECT-STORAGE SECTION.
       01  WS-NEXT-CRIT-CODE         PIC 99999 VALUE ZERO.


      ********************************************************
       METHOD-ID. "GetNextCritCode".
      ********************************************************

       PROCEDURE DIVISION.

       010-MAIN.

           ADD 1 TO WS-NEXT-CRIT-CODE.

           exhibit named WS-NEXT-CRIT-CODE.
           EXIT METHOD.

       END METHOD "GetNextCritCode".


       END OBJECT.

       END CLASS Class1.


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>