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

Error with START command - Status code=23


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Mon Jul 21, 2008 10:17 am
Reply with quote

I'm trying to read a VSAM file in my COBOL code using START command.
I am getting status code=23 when I try to read one record. I can confirm that the record I try to read is present in the VSAM file.

The below is my VSAM read,
Code:

START  <VSAM_FILE_NAME>
   KEY IS GREATER THAN  <KEY_REC>

The interesting part here is - to overcome this issue, we insert a dummy record with key value as 99999999999999 (key length is 14) at the end of the VSAM file and we process the VSAM successfully.

Could you please throw us some light why we are getting this error and how this workaround works. Is the issue related to by record or anything to do with setup.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Jul 21, 2008 2:45 pm
Reply with quote

You can't read a file with the START command, you should use READ instead...
But you can use START to position yourself before reading.
If the key is present, use KEY GREATER OR EQUAL otherwise you will just miss the record you want.
Back to top
View user's profile Send private message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Mon Jul 21, 2008 5:01 pm
Reply with quote

Hi Marso,

Exactly said.. I am issuing a START command prior to my read command.

I used START command with KEY GREATER THAN... And i am getting return code 23.


Appreciate your assistance.
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: Mon Jul 21, 2008 5:12 pm
Reply with quote

From the manual, a 23 file status means
Quote:
An attempt was made to randomly access
a record that does not exist in the
file, or a START or random READ
statement was attempted on an optional
input file that was not present.
If the key you're doing the START on has a larger value than any key in the VSAM file, you will get a 23 file status code. Adding a higher-valued key (such as HIGH-VALUES or all 9's) puts a record in the file with a key value higher than what you do the START on, and VSAM will return this record.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Jul 21, 2008 6:32 pm
Reply with quote

If the file is not optional and is present, then it is:
Quote:
An attempt was made to randomly access a record that does not exist in the file

Do you check the status also after the OPEN statement ?
Have you DISPLAYed the key before the START command, just to make sure you have a correct value ?
Try to do a START with KEY GREATER THAN LOW-VALUES and check if you can read the file at all.
Back to top
View user's profile Send private message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Wed Jul 30, 2008 11:11 am
Reply with quote

Apologizes for the delayed response...

Robert,

Rightly said.. I checked my file again. Though the key which I was looking for was there in the VSAM file, I could not find any key which is greater than that..

Thank you very much for your info...
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 30, 2008 4:37 pm
Reply with quote

Neo: You could use GE (GREATER THAN OR EQUAL TO) rather than GT is your KEY clause; this would allow the READ to return a record with exact key match. As you've got the code, it'll only return a record with a higher key value.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
Search our Forums:

Back to Top