COBOL Pointer variable

How to define a pointer variable


Define a pointer variable in Working-Storage Section


01  SILLY-POINTER                USAGE IS POINTER.


or


01  POINTERS-AND-OTHER-STUFF.
    05  SILLY-POINTER            USAGE IS POINTER.
    05  SILLY-VALUE              REDEFINES
        SILLY-POINTER            PIC S9(8) COMP.




Set pointer variable

Set from a regular variable

SET SILLY-POINTER TO ADDRESS OF RECORD-1.


RECORD-1 is a general variable in Working-Storage Section.


Set from another pointer

SET SILLY-POINTER TO SILLY-POINTER2.


SILLY-POINTER2 is another pointer type variable; so SILLY-POINTER and SILLY-POINTER2 point to same address.


Set to null

SET SILLY-POINTER TO NULL.



你可能感兴趣的:(COBOL)