View previous topic :: View next topic
|
Author |
Message |
cheryala
New User
Joined: 20 Mar 2006 Posts: 46
|
|
|
|
Hi Everybody,
Can anybody give me some idea on how to implement Linked Lists using either VS COBOL II or Enterprise Cobol ..
Thanks in Advance .
Raja Shekar |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Raja Shekar,
Please disribe what you mean by "LINKED LISTS", just so we're both on the same subject. Are you talking about storage management, or something else?
Please come back,
Dave |
|
Back to top |
|
|
cheryala
New User
Joined: 20 Mar 2006 Posts: 46
|
|
|
|
Hi DavidatK,
Linked List is a kind of storage management technique..It's one kind of a data structure where in you are going to allocate nodes dynamically. Each node is going to have one Pointer variable used to store the address of next node..the last node's pointer in the list is going to have null values...
Here a node can be a structure..for example
01 WS-STRUCT.
05 WS-STRUCT-NAME X(120).
05 WS-STRUCT-EMPID X(5).
05 WS-STRUCT-NEXT-NODE USAGE POINTER.
Thanks and Regards,
RSC |
|
Back to top |
|
|
cheryala
New User
Joined: 20 Mar 2006 Posts: 46
|
|
|
|
Hi,
Sorry,..i missed picture clause in the structure that i mentioned in my last post..
Regards,
RSC |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
RSC,
Good, this is what I was hoping you were talking about. I've done this many time in assembler, and several times in COLOL using a large allocated COBOL table. You however, want to dynamically allocate each occurrence of the nodes as you need them.
Tell me how you envision this functioning. i.e. pseudo code.
Do you have the availability of a callable GETMAIN routine from your Cobol program? I hope your going to say yes.
This will be fun to do. We will use the Linkage section for your LINKED LISTS.
Dave |
|
Back to top |
|
|
cheryala
New User
Joined: 20 Mar 2006 Posts: 46
|
|
|
|
Hi Dave,
I have implemented this kind of linked lists using PL/1 and C. In those languages we have inbuilt functions to allocate memory dynamically. But in cobol i don't find any command or inbuilt function to allocate memory dynamically for any array or structure..
Sorry to say u Dave that we don't have any GETMAIN routine kind of stuff..
Thanks and Regards,
RSC |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
RSC,
Well, this makes it harder, but maybe not impossable. Let me think on this for awhile and get back to you.
Could you write somethink in PL/I or C that's callable from COBOL to allocate the storage and pass back the location?
Dave |
|
Back to top |
|
|
cheryala
New User
Joined: 20 Mar 2006 Posts: 46
|
|
|
|
Hi Dave,
I can write a PL/I program to allocate memory..but i don't know how to call it from COBOL..
Thanks
RSC |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
RSC,
This I cannot help you with. If it dosn't use the standard calling parameter list, I don't know. We do NO PL/I in our shop. Maybe someone will have experience with this call.
Dave |
|
Back to top |
|
|
|