Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Open the same flat file more than once in the cobol program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Open the same flat file more than once in the cobol program
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    Post subject:
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    Post subject:
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    Post subject: Re: Opening flat file in Cobol program
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    Post subject:
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

Active Member


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

PostPosted: Wed May 09, 2007 5:41 pm    Post subject:
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

Site Director


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

PostPosted: Wed May 09, 2007 9:43 pm    Post subject:
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: 686
Location: Earth

PostPosted: Thu May 10, 2007 2:29 pm    Post subject:
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

Site Director


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

PostPosted: Thu May 10, 2007 7:22 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 7 Fri Sep 22, 2017 11:35 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Reply MQ open error Vignesh Sid COBOL Programming 5 Thu Sep 07, 2017 6:02 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us