IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Open the same flat file more than once in the cobol program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sonasheetal

New User


Joined: 08 Jun 2005
Posts: 27

PostPosted: Wed May 09, 2007 2:34 pm
Reply with quote

Hi all,

Can we open the same flat file more than once in the cobol program?

Regrads,
Sona.
Back to top
View user's profile Send private message
rz061m

New User


Joined: 03 Mar 2006
Posts: 48
Location: Chennai

PostPosted: Wed May 09, 2007 2:44 pm
Reply with quote

No, the program will abend saying FILE ALREADY OPEN
Back to top
View user's profile Send private message
anand_sundaramurthy

New User


Joined: 07 May 2007
Posts: 12
Location: Chennai

PostPosted: Wed May 09, 2007 3:02 pm
Reply with quote

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
View user's profile Send private message
sonasheetal

New User


Joined: 08 Jun 2005
Posts: 27

PostPosted: Wed May 09, 2007 3:05 pm
Reply with quote

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
View user's profile Send private message
itsmeaparna

New User


Joined: 28 Jul 2006
Posts: 4
Location: pune

PostPosted: Wed May 09, 2007 3:49 pm
Reply with quote

yes, u can.
After CLOSING the file with CLOSE verb, u can OPEN the same file again in same COBOL pgm.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Wed May 09, 2007 5:41 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed May 09, 2007 9:43 pm
Reply with quote

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
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu May 10, 2007 2:29 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu May 10, 2007 7:22 pm
Reply with quote

Yes, that is what my reply said. It just requires the close before the second open.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top