View previous topic :: View next topic
|
Author |
Message |
sonasheetal
New User
Joined: 08 Jun 2005 Posts: 27
|
|
|
|
Hi all,
Can we open the same flat file more than once in the cobol program?
Regrads,
Sona. |
|
Back to top |
|
|
rz061m
New User
Joined: 03 Mar 2006 Posts: 48 Location: Chennai
|
|
|
|
No, the program will abend saying FILE ALREADY OPEN |
|
Back to top |
|
|
anand_sundaramurthy
New User
Joined: 07 May 2007 Posts: 12 Location: Chennai
|
|
|
|
Hi sona,
Why do u need to open the same file more than once when its already opened?is there any specific requirement or u jus wanna know? |
|
Back to top |
|
|
sonasheetal
New User
Joined: 08 Jun 2005 Posts: 27
|
|
|
|
Thanks for your quick reply. But still I need a clarification.
After closing the file with CLOSE verb shall we open the same file once again in the same program? |
|
Back to top |
|
|
itsmeaparna
New User
Joined: 28 Jul 2006 Posts: 4 Location: pune
|
|
|
|
yes, u can.
After CLOSING the file with CLOSE verb, u can OPEN the same file again in same COBOL pgm. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
Or, are you asking if you can opent he same dataset more than once? This involves having more than one COBOL file point to the same dataset. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Can we open the same flat file more than once in the cobol program?
|
Not at the same time - whether it is the same FD or the same dataset.
You should be able close and re-open either the FD or the dataset if it is referenced by multiple FD/DD definitions. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Quote: |
You should be able close and re-open either the FD or the dataset if it is referenced by multiple FD/DD definitions. |
Dick,
I think it is possible with single FD/DD too..
psuedocode
Code: |
open input filea
do some operations
close filea
open extend filea
add some records
close filea
open input filea
do some opeartions
close filea |
Here filea is opened many times but in JCL single DD will be required.
Please let me know if you meant something else. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Yes, that is what my reply said. It just requires the close before the second open. |
|
Back to top |
|
|
|