IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Variable availability in Nested cobol Program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sreelekshmi

New User


Joined: 16 Jan 2007
Posts: 9
Location: Bangalore

PostPosted: Thu May 31, 2007 11:53 am
Reply with quote

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
View user's profile Send private message
pingte

Active User


Joined: 03 Dec 2005
Posts: 120
Location: india

PostPosted: Thu May 31, 2007 12:00 pm
Reply with quote

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
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu May 31, 2007 12:05 pm
Reply with quote

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
View user's profile Send private message
sreelekshmi

New User


Joined: 16 Jan 2007
Posts: 9
Location: Bangalore

PostPosted: Thu May 31, 2007 12:31 pm
Reply with quote

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
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu May 31, 2007 12:54 pm
Reply with quote

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
View user's profile Send private message
sreelekshmi

New User


Joined: 16 Jan 2007
Posts: 9
Location: Bangalore

PostPosted: Thu May 31, 2007 1:02 pm
Reply with quote

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
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu May 31, 2007 1:22 pm
Reply with quote

Is this discussion going on about COBOL? Just needed to confirm, because 'jargon' looks different. icon_confused.gif
Back to top
View user's profile Send private message
pingte

Active User


Joined: 03 Dec 2005
Posts: 120
Location: india

PostPosted: Thu May 31, 2007 1:38 pm
Reply with quote

What is the basic idea behing such nested programming icon_question.gif
Is it a client requirement or merely of theoritical interest icon_idea.gif
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu May 31, 2007 1:48 pm
Reply with quote

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
View user's profile Send private message
sreelekshmi

New User


Joined: 16 Jan 2007
Posts: 9
Location: Bangalore

PostPosted: Thu May 31, 2007 2:08 pm
Reply with quote

Ok ,this cleared my doubt.
Thanks once again


Sreelekshmi
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu May 31, 2007 5:23 pm
Reply with quote

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
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu May 31, 2007 5:37 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu May 31, 2007 5:54 pm
Reply with quote

Calling nested COBOL programs
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu May 31, 2007 6:21 pm
Reply with quote

agkshirsagar & Phrzby,

I hope you get the examples required.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Jun 01, 2007 11:46 am
Reply with quote

Thanks Bill and Murali,
I got to learn something new.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Fri Jun 01, 2007 5:51 pm
Reply with quote

Thanks as well - new to me, too.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Jun 01, 2007 6:05 pm
Reply with quote

The Enterprise COBOL Programmer's Guide has a lot of stuff I never associated with COBOL (dinosaur...), really kind of neat.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top