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
 

 

Error while opening the VSAM file in I-O mode

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Sun May 02, 2010 1:46 pm    Post subject: Error while opening the VSAM file in I-O mode
Reply with quote

HI,

I am facing a S0C4 abend when I am trying to open a VSAM file in I-O mode. VSAM file is empty, access mode is dynamic, organization is indexed. Can anybody please tell me how to resolve this issue?

Thanks
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: Sun May 02, 2010 2:37 pm    Post subject:
Reply with quote

Hello,

Why do you believe the open is causing an 0c4?

Suggest you load 1 record into the file and try again.

Also suggest you check the status after every command that uses the file.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Sun May 02, 2010 2:39 pm    Post subject:
Reply with quote

Well thats a lot of info supplied for us to work with.
Lets starts guessing. Maybe the following will apply :

The file status codes must be checked after every VSAM I/O. For instance, if you do not check the VSAM status code after an OPEN statement and a bad open was encountered, you will get a "0C4" completion code when you try to reference the I/O area. This completion code indicates that addressability to the I/O area is not established until a valid open has been accomplished.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Sun May 02, 2010 6:57 pm    Post subject:
Reply with quote

Quote:
I am trying to open a VSAM file in I-O mode. VSAM file is empty
This potentially is your first problem. When you say the VSAM file is empty, do you mean it is newly defined and has never contained records, or that it previously had records but they have all been deleted? The difference is important because a newly defined VSAM that has never had records in it CANNOT be opened for input, which means it cannot be opened for I-O either. This is a system restriction that you cannot get around.
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: Mon May 03, 2010 1:07 am    Post subject: Reply to: Error while opening the VSAM file in I-O mode
Reply with quote

Hi Robert,

Robert wrote:
This potentially is your first problem.
From the movies. . .
Quote:
Confidence is high, repeat, confidence is high.
Wargames, American Pie. . .

It is still hard for me to grasp an entire generation of coders that have not had "Check the status EVERY time!" drilled into them by their instructors or project seniors. I guess it is roll-down from the point-n-click world where if it runs at all it is deployed and then dealt with when it goes thud. . .

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

Global Moderator


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

PostPosted: Mon May 03, 2010 2:23 am    Post subject:
Reply with quote

I inherited a system last year. I was shocked to discover the previous programmer had actually removed all file status code variables and logic from the production programs (based on comments in the code). I'm still not sure why that was done, but other code in the system indicated this was not an ace programmer. One key program has the return code set to 20 if anything doesn't work, so when you get an RC 20, you get to go through all the code to figure out why the program didn't work. Why not use different codes for different conditions? I have no idea -- but it sure would have helped.
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Mon May 03, 2010 8:37 am    Post subject: Reply to: Error while opening the VSAM file in I-O mode
Reply with quote

I displayed the Status code... it is 47. Actually the VSAM file is coming from another system, we can say VSAM file is provided by the client, so i can't say it was empty earlier or the records were deleted. simply i can say that VSAM file may be empty. I tried the code when VSAM file was having the records. Job ran fine. But now when VSAM file is empty, i am facing S0C4 and vsam status code is 47. Hope this info will help.
Thanks
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon May 03, 2010 8:45 am    Post subject:
Reply with quote

The 47 is for the read, what was the status for the open?
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: Mon May 03, 2010 8:49 am    Post subject:
Reply with quote

Hello,

And if the OPEN was not successful, why was the program not terminated before ever trying to READ?
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Mon May 03, 2010 9:13 am    Post subject: Reply to: Error while opening the VSAM file in I-O mode
Reply with quote

Yeah.. VSAM open status is 35(i.e. VSAM is empty). I want to execute the program even if VSAM is empty. Can anybody tell me please what to do in this case if VSAM is empty. I-O mode (access mode dynamic) is necessary here as i want to read the VSAM Sequentially from a particular record. I am using the START verb to put the pointer on a particular record and thereafter i want to read it sequentially, if the VSAM file is having the records icon_sad.gif
Please tell me some solution.
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: Mon May 03, 2010 9:42 am    Post subject:
Reply with quote

Hello,

Load a record into the file. . .

You cannot open the file as input until a record has been added. . . The record can later be deleted. Did you read/understand what Robert posted previously?

Not a choice - a rule of vsam.
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Mon May 03, 2010 10:05 am    Post subject:
Reply with quote

Hi all,
Thanks a lot. i got that we can't open VSAm file for I/P or I-O if it is already empty. I have put the logic in the program where i am checking the status of VSAm while opening it. If it is 35 then i am skipping the portion of the program which include the processing of the VSAM file. Thanks all. icon_biggrin.gif
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: Mon May 03, 2010 7:04 pm    Post subject:
Reply with quote

Hello,

Quote:
i got that we can't open VSAm file for I/P or I-O if it is already empty
This is not correct. . . An empty file CAN be successfully opened. A file that has beed defined but never had a record written cannot be opened as input . . .

Quote:
If it is 35 then i am skipping the portion of the program which include the processing of the VSAM file.
There are other ways to get a status 35.

I believe the file should not be in this condition and that this should be corrected. . .

Even if this is "their" file and not "yours".
Back to top
View user's profile Send private message
Balraj

New User


Joined: 16 Aug 2007
Posts: 34
Location: Bangalore

PostPosted: Mon May 03, 2010 9:10 pm    Post subject: Reply to: Error while opening the VSAM file in I-O mode
Reply with quote

An empty VSAM file can be opened in I-O with the OPTIONAL (SELECT OPTIONAL filename)and check the ok status with '00' and '05. I think this solve the problem of empty VSAM file handling.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Mon May 03, 2010 10:47 pm    Post subject:
Reply with quote

Balraj, you are ALMOST right in what you said. From the COBOL Programming Guide (link at the top of the page):
Quote:
Next Topic Match
1.10.3.2.1 Opening an empty file

To open a file that has never contained records (an empty file), use a form of the OPEN statement.

Depending on the type of file that you are opening, use one of the following statements:

* OPEN OUTPUT for ESDS files.

* OPEN OUTPUT or OPEN EXTEND for KSDS and RRDS files. (Either coding has the same effect.) If you coded the file for random or dynamic access and the file is optional, you can use OPEN I-O.
Note that it must be ACCESS DYNAMIC or ACCESS RANDOM -- ACCESS SEQUENTIAL will not work for what you said. If you attempt to read from the file, you will get a file status 23.
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 S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
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 Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


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