View previous topic :: View next topic
|
Author |
Message |
najeeb
New User
Joined: 15 May 2009 Posts: 6 Location: trivandrum
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Why would you want to place an exclusive enqueue on a VSAM dataset? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
najeeb
New User
Joined: 15 May 2009 Posts: 6 Location: trivandrum
|
|
|
|
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
So while opening an empty VSAM file in COBOL in I-O ,I feel like 05 status is a green signal |
|
Back to top |
|
|
najeeb
New User
Joined: 15 May 2009 Posts: 6 Location: trivandrum
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
najeeb
New User
Joined: 15 May 2009 Posts: 6 Location: trivandrum
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
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 |
|
|
|