Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Variable availability in Nested cobol Program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Variable availability in Nested cobol Program
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    Post subject:
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: 685
Location: Earth

PostPosted: Thu May 31, 2007 12:05 pm    Post subject:
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    Post subject: Re: Variable availability in Nested cobol Program
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: 1439
Location: Bangalore,India

PostPosted: Thu May 31, 2007 12:54 pm    Post subject:
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    Post subject: Re: Variable availability in Nested cobol Program
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: 685
Location: Earth

PostPosted: Thu May 31, 2007 1:22 pm    Post subject:
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    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Thu May 31, 2007 1:48 pm    Post subject:
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    Post subject: Re: Variable availability in Nested cobol Program
Reply with quote

Ok ,this cleared my doubt.
Thanks once again


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

Active Member


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

PostPosted: Thu May 31, 2007 5:23 pm    Post subject:
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: 685
Location: Earth

PostPosted: Thu May 31, 2007 5:37 pm    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Thu May 31, 2007 5:54 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Thu May 31, 2007 6:21 pm    Post subject:
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: 685
Location: Earth

PostPosted: Fri Jun 01, 2007 11:46 am    Post subject:
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

Active Member


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

PostPosted: Fri Jun 01, 2007 5:51 pm    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Fri Jun 01, 2007 6:05 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us