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

VSAM file status 22 23 35


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
luttapi

New User


Joined: 05 Jun 2007
Posts: 24
Location: kerala

PostPosted: Sat Jun 21, 2008 12:28 pm
Reply with quote

After reading a record from a Vsam file which is opened in I-0 mode.
I am checking 'Valid key' (file status :22) and 'Not valid key' (file status:23). do we need to check any other filestatus other than above file status?

similarly after writing a record into Vsam file , is it enough to check file status '00' for successful write operation?
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Sun Jun 22, 2008 8:15 am
Reply with quote

as far as your checkings of VALID KEY and NON VALID KEY is concerned, it completely depends upon your requirement.

however, to check the successful WRITE operation, file-status '00' should work fine
Back to top
View user's profile Send private message
luttapi

New User


Joined: 05 Jun 2007
Posts: 24
Location: kerala

PostPosted: Sun Jun 22, 2008 5:12 pm
Reply with quote

I want to know what are the anticipated file status after read operation on Vsam file occurs.
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Sun Jun 22, 2008 6:06 pm
Reply with quote

Code:

0  Successful OPEN/READ/WRITE Operation
00 Successful completion
02 Duplicate key was detected which is allowed as per definition of AIX.
04 Length of record just READ didn’t conform to the fixed length attributes for the file.
05 Referenced Optional file is not present during OPEN. If open mode is I-O or EXTEND, then file will be created.
07 Open or Close statement is executed with a phrase that implies a tape file (ex NO REWIND) whereas the file is not in TAPE.

1  When AT END condition fails
10 Sequential READ is attempted on
11.after the end of file is reached
12.optional file that is not present.
14 Sequential READ was attempted for a relative file and RRN is larger than the maximum that can be stored in the relative key data item.

0  When INDEX Key fails
01 Sequence error exists for sequentially accessed index file.
02 Attempt was made to write a record that would create a duplicate key.
03 Record not found.(for keyed random access)
04 Space not found for WRITE

3  Permanent Open error
35 Opening a non-optional file that was not present.
37 Open mode is not permitted.
38 Open issued for a file that was closed previously with lock
39 File attribute mismatch-Open failed.

4  Logic error in opening/closing/deleting
41 OPEN a opened file.
42 CLOSE attempted for not opened file.
43 IO statement before the current REWRITE/DELETE is not successful.
44 REWRITE attempt with invalid length
47 READ file which is not opened in INPUT or I-O mode
48 WRITE file which is not opened in I-O OUPUT or EXTEND mode
49 DELETE or REWRITE file which is not opened in I-O mode.

9  Implementation defined
91 VSAM password error
92 Logic error
93 VSAM resource unavailable
96 No DD statement specified for VSAM file.
97 File integrity verified for VSAM file.
Back to top
View user's profile Send private message
luttapi

New User


Joined: 05 Jun 2007
Posts: 24
Location: kerala

PostPosted: Sun Jun 22, 2008 6:42 pm
Reply with quote

thanks a lot
Back to top
View user's profile Send private message
luttapi

New User


Joined: 05 Jun 2007
Posts: 24
Location: kerala

PostPosted: Sat Jun 28, 2008 5:51 pm
Reply with quote

I have one more doubt .

Can we open a empty VSAM file in I-O mode.? I got file status 35 when I was trying to open and empty Vsam file through pregame.

file Status 35 :Opening a non-optional file that was not present.
what does it mean. can some one give more explanation about this error.

thanks,
Luttapi
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jun 28, 2008 7:25 pm
Reply with quote

Hello,

Make sure the file is not empty.

Many places insert a record with a key of low-values and a record with a key of high-values to prevent this problem. There are several topics in the forum about initializing vsam files.

Of course, if you create these "initialization records", the code using the file must be aware of them and ignore them as appropriate.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Sat Jun 28, 2008 7:48 pm
Reply with quote

An empty file (i.e., a file that has NOT had any records written to it) cannot be opened for INPUT or I-O. This applies to VSAM, sequential, or whatever.
Back to top
View user's profile Send private message
luttapi

New User


Joined: 05 Jun 2007
Posts: 24
Location: kerala

PostPosted: Sun Jun 29, 2008 2:09 pm
Reply with quote

thanks a lot for your support.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Jun 30, 2008 9:55 am
Reply with quote

Hi Robert,
maybe I misuderstood your comment.

If I allocate an empty file using ISPF 3.2, I can sort this file without issues.

So I don't understand the bit about it cannot be opened for INPUT etc.


Gerry
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 30, 2008 10:41 am
Reply with quote

Hi Gerry,

Possibly a reference to the "old days" (pre-sms) when merely allocating a dataset did not create a valid end-of-file?

I remember people who had trouble with qsam files that were merely allocated but not opened for output and closed (which created a valid eof). Sometimes a wrong length record occurred and sometimes "the wrong data" was used in a job (depending on what had previously been allocated at that place on the dasd).

I don't recall the need to actually write a record, though. Opening the file as output and closing it was enough. With sms-managed data, i believe any allocaton (tso, jcl, etc) creates a valid eof and qsam files will go "at end" on the first read with no problems.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Jun 30, 2008 10:57 am
Reply with quote

Hi Dick,

yes, that's what I remember, as long as the file was intialised, (opened and closed) all was well.

There was an episode where an empty file was created, the DDNAME was not opened by the program (only opened if input file had those record types) and when printing the file, it started printing the wrong data.


Gerry
Back to top
View user's profile Send private message
luttapi

New User


Joined: 05 Jun 2007
Posts: 24
Location: kerala

PostPosted: Wed Jul 02, 2008 5:15 pm
Reply with quote

Hi dick,

as per your suggestion, I have written a lowvalue into that Vsam file .It is working properly now. But is there any other way to remove that lowvalue record . and open it in I-O.

thanks in advance,
luttapi
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Jul 02, 2008 5:33 pm
Reply with quote

Dick: you're right -- sms-allocated files do not require the file be opened for output; I've learned something new today. And even in the old days the file did not have to have a record written -- merely opened for output and closed. However, I can't count the number of times programmers told me they did that when they merely used IEFBR14 (which doesn't open the file).

Gerry: I've seen more than once where a file was defined, opened for input, and whatever data was on the track before the file was created was input. Usually some form of record length error occurred, but sometimes the record lengths matched and bad data got processed.

luttapi: suggestion: add a //DUMMYIN DD DUMMY,LRECL=?,BLKSIZE=? to your VSAM delete/define JCL, and after the DEFINE CLUSTER do a REPRO INFILE(DUMMYIN) ODS(your.vsam.file.name). That will initialize the VSAM file without adding a LOW-VALUES record to it.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jul 02, 2008 10:36 pm
Reply with quote

Quote:
but sometimes the record lengths matched and bad data got processed.
Heh heh heh - especially when a very high number of files were 80/800. . . icon_smile.gif

d
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jul 03, 2008 1:18 pm
Reply with quote

Robert Sample wrote:
Dick: you're right -- sms-allocated files do not require the file be opened for output; I've learned something new today. And even in the old days the file did not have to have a record written -- merely opened for output and closed. However, I can't count the number of times programmers told me they did that when they merely used IEFBR14 (which doesn't open the file).

My little experience says that it's far better to ensure that any file created has an EOF rather than try to figure this out later. Yup, one easy way to force an EOF is open the file for output, then close it without any write statements. You can also generate an EOF with IEBGENER or SORT.

In days past, simply cataloging a dataset caused the problem of no EOF which in turn caused abends (or running with incorrect data).

With SMS-managed data, an EOF is created automatically when the file is allocated.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top