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

VSAM file opening status 05 for first time


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
najeeb

New User


Joined: 15 May 2009
Posts: 6
Location: trivandrum

PostPosted: Wed Mar 23, 2011 12:43 am
Reply with quote

In my COBOL program, I open a VSAM file in I-O mode to update records at some condition(s).
, I am defining the VSAM file using IDCAMS.
In my JCL am using DISP=MOD. When the Job runs for the first time
But it fails to open the file in I/O mode.file status am getting is 05
but if i resubmit the job it goes fine...
pls help
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Mar 23, 2011 12:55 am
Reply with quote

Error messages issued by the failing run ?
Have you looked up status code 5 ? What was the explanation
Did you try google.

Please tell us everything that you have already investigated and what you found so as to avoid duplication of effort
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Mar 23, 2011 12:56 am
Reply with quote

Review the sticky, entitled "COBOL qsam/vsam FILE STATUS CODES", found on the following forum page -

ibmmainframes.com/forum-1.html

Bill
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Mar 23, 2011 4:01 am
Reply with quote

Why would you want to place an exclusive enqueue on a VSAM dataset?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Mar 23, 2011 6:59 am
Reply with quote

Quote:
In my COBOL program, I open a VSAM file in I-O mode to update records at some condition(s).
, I am defining the VSAM file using IDCAMS.
In my JCL am using DISP=MOD. When the Job runs for the first time
Just to check -- you ARE writing a record to the file before opening it, right? If not, you need to become aware that it is not possible to open a VSAM file for INPUT or I-O in COBOL unless at least one record has been written to the file (the record can be deleted immediately). See section 1.10.3.2.1 of the COBOL Programming Guide (manuals link is at the top of the page). Making the file optional, as described in this section, does not remove the requirement.

I suspect what is happening is you've defined the file as optional and the first time the program runs, the file open attempt gets a file status 05. When you rerun the program, since the file has now been opened for output, the open works with file status 00.
Back to top
View user's profile Send private message
najeeb

New User


Joined: 15 May 2009
Posts: 6
Location: trivandrum

PostPosted: Wed Mar 23, 2011 10:16 pm
Reply with quote

Robert- Thanks for your inputs

I have bypassed the 05 status during first time run and to my surprise i was able to write records successfully icon_smile.gif

So while opening an empty VSAM file in COBOL in I-O ,I feel like 05 status is a green signal
Back to top
View user's profile Send private message
najeeb

New User


Joined: 15 May 2009
Posts: 6
Location: trivandrum

PostPosted: Wed Mar 23, 2011 10:20 pm
Reply with quote

I feel like Bypassing 05 status is the only turn around to OPEN an empty VSAM file in I-O in COBOL
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Mar 23, 2011 10:35 pm
Reply with quote

The first digit of the file status code being a zero means the operation (OPEN in this case) succeeded, but the second digit not benig zero means potential problems. If you attempted to READ from the file after getting an 05 file status code, that attempt would fail -- probably (but don't quote me on this) with a 92 or 46 file status code.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Mar 24, 2011 1:23 am
Reply with quote

I have to ask this question for the 100 millionth time - why are you not initializing this dataset after you create it, before it's used for the first time?
Back to top
View user's profile Send private message
najeeb

New User


Joined: 15 May 2009
Posts: 6
Location: trivandrum

PostPosted: Thu Mar 24, 2011 9:10 pm
Reply with quote

The first step of my job should create the file .. in the second step should write the record by opening.. am afraid how can i initialise in between
without opening
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Mar 24, 2011 9:16 pm
Reply with quote

Open it in output mode, not I-O, write a dummy record, close file. I believe you can do this in the IDCAMS execution by using REPRO.
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 -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts How to turn off 'ACTION' SDSF output ... TSO/ISPF 2
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
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
Search our Forums:

Back to Top