View previous topic :: View next topic
|
Author |
Message |
sreelekshmi
New User
Joined: 16 Jan 2007 Posts: 9 Location: Bangalore
|
|
|
|
Hi,
I am using a nested cobol program.In the main program I have declared some working storage fields.Can I use the same fields in the nested program without declaring it again in the nested program?If so,how the nested program will be taking those feilds from the main program?
Thanks
Sreelekshmi |
|
Back to top |
|
|
pingte
Active User
Joined: 03 Dec 2005 Posts: 120 Location: india
|
|
|
|
What do you mean by a nested cobol program..
Is it a called prorgram.. i.e to it subprogram u r calling from main program? |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
What do you mean by nested program? a subprogram?
If you mean subprogram, then you need to declare variables there too..
Please give some more informatil about your question.. |
|
Back to top |
|
|
sreelekshmi
New User
Joined: 16 Jan 2007 Posts: 9 Location: Bangalore
|
|
|
|
Nested program is like one program inside another program.We used to write the nested program inside the main program itself.It starts with a seperate identification division inside the main program.
Thanks
Sreelekshmi |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
sreelekshmi,
Quote: |
I am using a nested cobol program.In the main program I have declared some working storage fields.Can I use the same fields in the nested program without declaring it again in the nested program?If so,how the nested program will be taking those feilds from the main program? |
Yes. But the other way can't be done (i.e., variables declared in sub-program cannot be reffered in the main program).
If you have any common variable, local variable overrides the global/main program declaration. |
|
Back to top |
|
|
sreelekshmi
New User
Joined: 16 Jan 2007 Posts: 9 Location: Bangalore
|
|
|
|
Hi Murali,
Thanks for the reply.
But how the nested program can use the variables declared in the main program without declaring the main program varaibles as global?In my program none of the fields are declared as global.
Regards,
Sreelekshmi |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Is this discussion going on about COBOL? Just needed to confirm, because 'jargon' looks different. |
|
Back to top |
|
|
pingte
Active User
Joined: 03 Dec 2005 Posts: 120 Location: india
|
|
|
|
What is the basic idea behing such nested programming
Is it a client requirement or merely of theoritical interest |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
agkshirsagar,
Quote: |
Is this discussion going on about COBOL? Just needed to confirm, because 'jargon' looks different. |
Yes, it is about cobol language.
sreelekshmi,
Quote: |
But how the nested program can use the variables declared in the main program without declaring the main program varaibles as global?In my program none of the fields are declared as global. |
By default any variable declared in the nested program is visible to that level as well as sub level. |
|
Back to top |
|
|
sreelekshmi
New User
Joined: 16 Jan 2007 Posts: 9 Location: Bangalore
|
|
|
|
Ok ,this cleared my doubt.
Thanks once again
Sreelekshmi |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
Please include an extremely short example of your nested COBOL program. Just the essentials, so we can see the structure, and how this variable is known at different levels. Thanks. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
OP liked answer from murmohk1 and he too seems well versed with 'nested COBOL programs'. May be he can help us understanding nested COBOL program. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
agkshirsagar & Phrzby,
I hope you get the examples required. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Thanks Bill and Murali,
I got to learn something new. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
Thanks as well - new to me, too. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
The Enterprise COBOL Programmer's Guide has a lot of stuff I never associated with COBOL (dinosaur...), really kind of neat. |
|
Back to top |
|
|
|