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
 

 

VSAM file opening status 05 for first time

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
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    Post subject: VSAM file opening status 05 for first time
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: 8593
Location: Back in jolly old England

PostPosted: Wed Mar 23, 2011 12:55 am    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Mar 23, 2011 12:56 am    Post subject: Reply to: VSAM file opening status 05 for first time
Reply with quote

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

http://ibmmainframes.com/forum-1.html

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

Moderator Team Head


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

PostPosted: Wed Mar 23, 2011 4:01 am    Post subject: Reply to: VSAM file opening status 05 for first time
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: 7912
Location: Bellevue, IA

PostPosted: Wed Mar 23, 2011 6:59 am    Post subject:
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    Post subject: Reply to: VSAM file opening status 05 for first time
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    Post subject:
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: 7912
Location: Bellevue, IA

PostPosted: Wed Mar 23, 2011 10:35 pm    Post subject:
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

Moderator Team Head


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

PostPosted: Thu Mar 24, 2011 1:23 am    Post subject: Reply to: VSAM file opening status 05 for first time
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    Post subject: Reply to: VSAM file opening status 05 for first time
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: 1715
Location: UK

PostPosted: Thu Mar 24, 2011 9:16 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics 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
This topic is locked: you cannot edit posts or make replies. Natural ADABAS Opening with CTS enikhilk Mainframe Jobs 0 Wed Nov 30, 2016 5:37 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
This topic is locked: you cannot edit posts or make replies. Get a job submitted itself every time... arunsoods JCL & VSAM 3 Tue Nov 22, 2016 4:05 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


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