Sub programs



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Sub programs

Postby uday123 » Tue Apr 13, 2010 7:15 pm

Hi ,

Suppose main pgm A calls sub pgm B.
Main pgm A opens a file and calls B , which inturn writes into file and returns control to A.
Should we declare the file both in pgm A and pgm B or is it enough if we declare it in A alone?
If so why? Please guide.

Thanks
Uday
uday123
 
Posts: 29
Joined: Fri Feb 06, 2009 6:13 am
Has thanked: 0 time
Been thanked: 0 time

Re: Sub programs

 

Re: Sub programs

Postby Robert Sample » Tue Apr 13, 2010 8:42 pm

Find the COBOL Language Reference guide and look up EXTERNAL files. If the subprogram (B in your case) does not have an FD, how would the WRITE statement know what to write and where to write it to?
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: Sub programs

Postby Anuj Dhawan » Sun Apr 18, 2010 8:04 pm

And the other way is just try what you think system will tell you, where you are going wrong!
Anuj
Anuj Dhawan
 
Posts: 274
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post