Page 1 of 1

Pointers in COBOL

PostPosted: Mon May 11, 2009 5:32 pm
by eprasad629
Hi,

I facing problem in understanding the concept of pointers in COBOL.

Could you please explain this and their advantage of using in programs?

Many thanks in advance.

Thanks & Regards,
Praelay.

Re: Pointers in COBOL

PostPosted: Mon May 11, 2009 6:26 pm
by swd
Welcome to the world of linked lists. The use of pointers can be a long and complex issue, particually if you have no experience of using them. I haven't got time to go into it and explain all, but if you look at this web page it explains the basic principles quite well (this web page is nothing to do with me - I just googled it!).

http://home.swbell.net/mck9/cobol/tech/linklist.html

We use linked lists A LOT in our product where I work, and they can take a bit getting used to. As well knowing about the advantages of pointers, it's also good to know about the disadvantages too. If you don't manage your pointers properly you can get memory leaks all over the place - watch out for this!

What you are doing is managing the memory your program uses, rather than let the operating system do it for you. You are allocating memory dynamically, and this is generally more efficient.

See if this link gives you what you want to know, and perhaps other forum users can add more details too.

Cheers
Steve

Re: Pointers in COBOL

PostPosted: Tue May 12, 2009 8:02 am
by dick scherrer
Hello,

Could you please explain this and their advantage of using in programs?
If you nave no requirement to use them, there is no advantage.

It appears that you have a solution in search of a requirement.

Suggest you never implement a linked list in a program that is to be promoted to Production without specific direction/permission to do so.

While they are just another form of a "linked list", system control blocks can be navigated using pointers.