In message <67F9BAA7C151D6118BD2004081024E712ABDE8@DVMMSX1>, "Atwood,
Tim (DVM)" <[log in to unmask]> writes
>I want to have a COBOL subprogram located in an XL to be aware of a file
>opened in the main program. I want the subprogram to use standard COBOL IO
>statements to access the file rather than needing to use file intrinsics
>directly.
>
>If the subprogram was linked into the same run unit rather than an XL, I
>know I would use "IS EXTERNAL" on the FD entry. But I do not think this
>works with a subprogram in the XL. Is this correct?
>
>Is this where I am supposed to use the "IS GLOBAL" syntax instead? I not
>quite clear on what the difference between "GLOBAL" and "EXTERNAL" is.
>
>Assuming this approach works, any other problems with it? Any other way to
>do this?
If you put all the file handling in the subprogram - the Open, the Read
and Write accesses, the Close - it can solve a lot of problems with this
sort of file handling.
I'm not clear if you want the subprogram to handle Reads and Writes,
etc., besides having the main program do these as well, or whether you
are thinking of having the subprogram do all that handling.
If the latter, let it do the Open - either implicit on first use of the
file or explicit, on an entry point or a passed parameter - and the
Close as well - either on program close (a bit scruffy, but OK on HP
COBOL) or, again, as an entry point or a passed parameter in a single
top-entry call (especially if you are thinking of program portability).
If both the subprogram and the main program are going to access the
file, well, I look forward to the answers incorporating
GLOBAL/EXTERNAL....
--
Roy Brown 'Have nothing in your houses that you do not know to be
Kelmscott Ltd useful, or believe to be beautiful' Wm Morris
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|