View previous topic :: View next topic
|
Author |
Message |
asis8888
New User
Joined: 16 Jan 2009 Posts: 2 Location: Chennai
|
|
|
|
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 |
|
|
asis8888
New User
Joined: 16 Jan 2009 Posts: 2 Location: Chennai
|
|
|
|
I thought of using internal tables but my input file has got nearly 36000 records. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
How many times will you be opening this file? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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. . . |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
Back to top |
|
|
|