Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Error with START command - Status code=23

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SMS & VSAM
Author Message
feellikeneo

Active User


Joined: 19 Mar 2007
Posts: 79
Location: Chennai

PostPosted: Mon Jul 21, 2008 10:17 am    Post subject: Error with START command - Status code=23
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
References
PostPosted: Mon Jul 21, 2008 10:17 am    Post subject: Re: Error with START command - Status code=23 Reply with quote

Marso

Senior Member


Joined: 13 Mar 2006
Posts: 303
Location: Israel

PostPosted: Mon Jul 21, 2008 2:45 pm    Post subject:
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

Active User


Joined: 19 Mar 2007
Posts: 79
Location: Chennai

PostPosted: Mon Jul 21, 2008 5:01 pm    Post subject:
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

Senior Member


Joined: 06 Jun 2008
Posts: 565
Location: Atlanta, GA

PostPosted: Mon Jul 21, 2008 5:12 pm    Post subject:
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

Senior Member


Joined: 13 Mar 2006
Posts: 303
Location: Israel

PostPosted: Mon Jul 21, 2008 6:32 pm    Post subject: Reply to: Error with START command - Status code=23
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

Active User


Joined: 19 Mar 2007
Posts: 79
Location: Chennai

PostPosted: Wed Jul 30, 2008 11:11 am    Post subject:
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

Senior Member


Joined: 06 Jun 2008
Posts: 565
Location: Atlanta, GA

PostPosted: Wed Jul 30, 2008 4:37 pm    Post subject:
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SMS & VSAM All times are GMT + 6 Hours
Page 1 of 1