View previous topic :: View next topic |
Author |
Message |
Novice Beginner
Joined: 27 Dec 2002 Posts: 46 Topics: 15
|
Posted: Mon Apr 11, 2005 6:40 am Post subject: Pointer Usage |
|
|
Can I acheive the following ?
I have a large AREA needs to be passed to a sub routine and do some calculation in the sub routine. A few options suggested were
1)Pass the entire AREA in a call statement
2)Get the pointer for the area, and pass the pointer.
Which one of them will be better. The area size is approximately 20 K.
Also for the second option I can use a set statement with address of parameter to get the pointer in the CALLING program but once I pass on the pointer to the CALLED program, How do I convert the pointer back to AREA? This application is CObol Only.
Any thoughts and help is greatly appreciated.
Novice |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Apr 11, 2005 7:55 am Post subject: |
|
|
NOvice,
Techinically speaking there isn't much of difference between passing the data vs using a pointer. When a sub-routine receives control, the underlying ASSEMBLER establishes addressability to the Caller's parameter. CALL instruction does not really pass any data. All it does is pass an address pointer. The subroutine then looks at that memory address location, so the subroutine is actually using a data area that is in the calling program.
I would go with passing the entire area as not many programmers are comfortable using pointers.
Check this link for a detailed explanation of pointer.
http://home.swbell.net/mck9/cobol/tech/cobolptr.html
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Novice Beginner
Joined: 27 Dec 2002 Posts: 46 Topics: 15
|
Posted: Mon Apr 11, 2005 11:30 pm Post subject: |
|
|
Thanks Kolusu.
regards
Novice |
|
Back to top |
|
 |
|
|