Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using pointers in cobol programs... 2

Status
Not open for further replies.

XPPROGRAMMER

Programmer
Nov 15, 2004
44
US
Hello,

if we dereference a pointer in the same runtime module,
would that cause an abend or an unpredictable behavior?
for example:

working-storage section.
01 my-pointer usage is pointer value null.

linkage section.
01 my-storage pic x(80).

procedure division.
0001-main.
set my-pointer to address of my-storage.
*> or
set my-storage to address of my-pointer.

would that be ok?
I am using windows xp pro with microfocus net express 3.1,
thanks for the kind help.


 
set my-pointer to address of my-storage *> OK provided the program is called with at least one parameter

set my-storage to address of my-pointer *> higly depends on the actual value of my-pointer.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
actually for line #2 ...

set my-storage to address of my-pointer.

shouldn't the syntax actually be

set address of my-storage to my-pointer.

The line you had in there sounds like you're trying to make my-storage (which is not a pointer) point to the address of my-pointer (which makes no sense). The only thing you can do is set the address of the my-storage to equal the contents of my-pointer, which is basically another address.

Make sense?

.DaviD.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top