Pointers in COBOL



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Pointers in COBOL

Postby eprasad629 » Mon May 11, 2009 5:32 pm

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.
Thanks & Regards,

Praelay
--------------------------------
eprasad629
 
Posts: 34
Joined: Wed Jan 07, 2009 12:48 pm
Location: Bangalore
Has thanked: 0 time
Been thanked: 0 time

Re: Pointers in COBOL

Postby swd » Mon May 11, 2009 6:26 pm

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
User avatar
swd
 
Posts: 109
Joined: Wed Feb 18, 2009 9:18 pm
Location: UK
Has thanked: 0 time
Been thanked: 0 time

Re: Pointers in COBOL

Postby dick scherrer » Tue May 12, 2009 8:02 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post