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中定义指针变量,并演示了如何将普通变量地址赋值给指针,如何从一个指针复制地址到另一个指针,以及如何将指针设置为null。
1万+

被折叠的 条评论
为什么被折叠?



