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

How to reopen input file?


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

New User


Joined: 16 Jan 2009
Posts: 2
Location: Chennai

PostPosted: Tue Oct 06, 2009 11:12 pm
Reply with quote

Hi, I'm trying to reopen an input file in a cobol program. After reaching the end of the file, I'm closing it. In the next paragraph when I try to open it, I'm getting a 4038 abend with a file status of 47. The input file is a sequential file.

The code is:
Open input input-file1
read till end of file.
close input-file1.
open input-file1.
read till end again.
Back to top
View user's profile Send private message
asis8888

New User


Joined: 16 Jan 2009
Posts: 2
Location: Chennai

PostPosted: Tue Oct 06, 2009 11:20 pm
Reply with quote

I thought of using internal tables but my input file has got nearly 36000 records.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Oct 06, 2009 11:58 pm
Reply with quote

How many times will you be opening this file?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Oct 06, 2009 11:58 pm
Reply with quote

A file status 47 occurs when a READ is attempted on a file that is not open for INPUT or I-O mode. Either your OPEN is failing (check the file status code after the second OPEN statement is executed, or you think your code is doing something it is not (namely, opening the file a second time).

And, please, post actual code -- not your summary of what the code does -- as oftentimes only the actual code tells us where the problem is. And also helpful would be the DD statement in your JCL for this file.

Finally, what's the problem with 36,000 records? Enterprise COBOL allows 01 levels to be up to 128 megabytes, so unless you're keeping thousands of bytes per record, a 36,000 element table can easily be stored in a COBOL program. In fact, if you are planning on reading the file more than twice it most likely will be faster to use an array rather than repeated reads of the entire file.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Oct 07, 2009 10:25 am
Reply with quote

Suggest you tell us why do you think OPENing file multiple times should be a choice for your design and yes please post the actual code as Robert has said.
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 Oct 07, 2009 7:45 pm
Reply with quote

Hello,

Quote:
why do you think OPENing file multiple times should be a choice for your design
Possibly to avoid writing code to match 2 files by some key. . . icon_cool.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Oct 08, 2009 10:50 am
Reply with quote

Here is a thread which is worth to be linked here, I believe... www.ibmmainframes.com/viewtopic.php?t=29392&highlight=

Copule of other threads are also there, you may search the forum.
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
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
Search our Forums:

Back to Top