Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

File status 47

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Thu Jul 11, 2013 11:54 pm    Post subject: File status 47
Reply with quote

I am having a VSAM file opened in I-O mode. I am reading the file randomly using a key. But when I do the reading I am getting the file status as 47. I want to read the file and see if the record exists based on the key. If it does that update the file (REWRITE) and otherwise write the record into the file. Kindly help.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Fri Jul 12, 2013 12:09 am    Post subject:
Reply with quote

Did you even check the manual to see what file status 47 means? If so, you would have found
Quote:
The execution of a READ statement was attempted on a file not open in the
input or I-O mode.
and you would know that one of these issues occurred:
(1) your file did not open and you did not check the file status code on OPEN,
(2) the file was processed then closed, and your code "fell through" into the READ again,
(3) you did not open the file in INPUT or I-O mode,
etc ....
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Fri Jul 12, 2013 12:20 am    Post subject: Reply to: File status 47
Reply with quote

Hi Robert,

I had in initiated this thread only after going through the manuals and I had made sure that they are not happening. I am opening the file at the beginning in the I-O mode and then reading the file till the end of the file. When I am reading the records and checking for existence is when I am getting this. I am doing the debug in xpediter thats the reason I am so sure.

Please advise.

Regards Suraaj
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Fri Jul 12, 2013 12:41 am    Post subject:
Reply with quote

The system is telling you that the file is not open in INPUT or I-O mode when your code executes the READ statement. This is what a 47 file status code means.

Whether or not you believe it does not really matter. Nor does it matter that you are using Xpediter to debug the code. The only thing that matters is that the system is telling you when the READ is being executed the file is not open in INPUT nor I-O mode -- period. You may continue to state contrary opinions as long as you want, but the fact remains -- as long as you do not accept that the file is not open for INPUT / I-O mode when that particular READ statement is executed, you will not be able to resolve the problem you posted.

If you want further assistance, you'll need to post the SELECT, the OPEN, the READ statement in question, using the CODE button.
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Fri Jul 12, 2013 12:44 am    Post subject:
Reply with quote

Maybe the file was OPENed and then CLOSEd ? Your file is definitely not OPENed when your do your READ.

Status Key 47
The execution of a READ statement was
attempted on a file not open in the
INPUT or I-O mode.

Code:
Select your-file      Assign to   your-dd
            Organization   INDEXED
            Access      RANDOM
            Record key   MAIN-KEY   {in record description}
            File Status   WS-STATUS.   {in Working-Storage}
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: Fri Jul 12, 2013 1:23 am    Post subject:
Reply with quote

Hello,

What causes your code to end when all of the input has been read?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Jul 12, 2013 5:08 am    Post subject: Reply to: File status 47
Reply with quote

COBOL also has the "extended FILE-STATUS" for VSAM files which gives information about what VSAM tells you happened. Include that as well.
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Fri Jul 12, 2013 6:43 pm    Post subject: Reply to: File status 47
Reply with quote

Thanks all...

I am getting a file status 39 for the open file. So much for the file status 47 for the read statement. Still pondering for the 39 status.

Regards Suraaj
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: Fri Jul 12, 2013 6:47 pm    Post subject:
Reply with quote

Hello,

There should be nothing mysterious about a 39 . . .

Between the code and the file, there is most likely a length mis-match.
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Tue Jul 16, 2013 5:58 pm    Post subject: Reply to: File status 47
Reply with quote

The issue was with the offset. I had started the offset from 1 instead of 0 so instead of 1768 I had given 1769 in the offset of key. Thanks Dick Scherrer, Bill Woodger, Gary McDowell and Robert Sample.
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: Tue Jul 16, 2013 8:01 pm    Post subject:
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

d
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us