View previous topic :: View next topic |
Author |
Message |
karavi2000 Beginner
Joined: 17 Aug 2003 Posts: 51 Topics: 26 Location: Chennai
|
Posted: Fri Apr 30, 2004 2:31 am Post subject: Writing in Subprogram while opening in Main Program |
|
|
Hi,
This is a requirement which was already posted in this forum. There were no clear answers into how to go into the problem. I just want to refresh it as I have a similiar requirement like this now.
This is my requirement. The file should be opened and closed in the main program but will be written into in a subroutine.
How many ways this can be accomplised?
Please let me know.
Thanks & Regards,
Ravishankar |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Apr 30, 2004 4:43 am Post subject: |
|
|
karavi2000,
Quote: |
This is a requirement which was already posted in this forum. There were no clear answers into how to go into the problem
|
Can you post the link you are refering to ? I did a search and could not find any thing related to your requirement.
To answer your question you can define the files as "EXTERNAL" . For every program with the cobol run unit the file defined as external will have access to the file. You can open and close in the main program and IO operations like read and write can be done in sub programs.
Check this link for a detailed explanation of Sharing files between programs (external files)
The above link also has an example
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
bauer Intermediate
Joined: 10 Oct 2003 Posts: 317 Topics: 50 Location: Germany
|
Posted: Fri Apr 30, 2004 5:06 am Post subject: |
|
|
Hi,
same option works for PL/I programs.
Other possibility:
Pass the file handle as parameter from the main program to the subprogram.
If need PL/1 sample code, pls let me know.
Regrads,
J. Bauer |
|
Back to top |
|
 |
|
|