Page 1 of 1

Sub programs

PostPosted: Tue Apr 13, 2010 7:15 pm
by uday123
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

Re: Sub programs

PostPosted: Tue Apr 13, 2010 8:42 pm
by Robert Sample
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?

Re: Sub programs

PostPosted: Sun Apr 18, 2010 8:04 pm
by Anuj Dhawan
And the other way is just try what you think system will tell you, where you are going wrong!