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
 
How to reopen input file?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to reopen input file?
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    Post subject:
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    Post subject:
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: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Tue Oct 06, 2009 11:58 pm    Post subject:
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

Senior Member


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

PostPosted: Wed Oct 07, 2009 10:25 am    Post subject:
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

Site Director


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

PostPosted: Wed Oct 07, 2009 7:45 pm    Post subject:
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

Senior Member


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

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

Here is a thread which is worth to be linked here, I believe... http://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    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 Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

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