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

File status code 92 for reading a vsam file


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

New User


Joined: 16 Sep 2006
Posts: 27
Location: Hyderabad

PostPosted: Tue Sep 15, 2009 4:38 pm
Reply with quote

Hi,
I checked out this one in previous post and they have gave the answer that the file has corrupted and reload it, I did the same but it did not worked.
my code
======
FILE-CONTROL.
SELECT COTBL ASSIGN TO COTBL
RECORD KEY IS COT-KEY
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
FILE STATUS IS COTBL-FILE-STATUS.

OPEN INPUT COTBL.
DISPLAY 'FILESTATUS= ' COTBL-FILE-STATUS
READ COTBL NEXT RECORD AT END MOVE 'Y' TO WS-COTBL-IND.
IF COTBL-FILE-STATUS NOT = '00'
DISPLAY 'FILESTATUS= ' COTBL-FILE-STATUS
END-IF.
CLOSE COTBL.

it displays the following

FILESTATUS= 00
FILESTATUS= 92
COT-REC=




as it could not able to read the file.
Pls suggest me the needful.
Thanks,
Prashant
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: Tue Sep 15, 2009 4:45 pm
Reply with quote

Try moving LOW-VALUES to your key before doing the READ. Since you're using a dynamically accessed file, I would do a START with LOW-VALUES in the key to ensure I established the record pointer before doing a READ NEXT.

The 92 file status code (LOGIC ERROR) indicates you're attempting to read a NEXT record without having established a current record to read the next record after.
Back to top
View user's profile Send private message
ch.prashant

New User


Joined: 16 Sep 2006
Posts: 27
Location: Hyderabad

PostPosted: Tue Sep 15, 2009 4:48 pm
Reply with quote

well i want to read the vsam file sequentially without using the key so suggest me the synatx for the file control and syntax for the read option.
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: Tue Sep 15, 2009 4:51 pm
Reply with quote

Code:
SELECT COTBL ASSIGN TO COTBL
RECORD KEY IS COT-KEY
ORGANIZATION IS INDEXED
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS COTBL-FILE-STATUS.
then open the file for input and start reading.

ACCESS DYNAMIC requires you to establish a current record pointer before reading sequentially -- even for the first record of the file.
Back to top
View user's profile Send private message
ch.prashant

New User


Joined: 16 Sep 2006
Posts: 27
Location: Hyderabad

PostPosted: Tue Sep 15, 2009 4:55 pm
Reply with quote

Could u give me the synatx for reading file too
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Tue Sep 15, 2009 4:56 pm
Reply with quote

If this is the requirement then Why to use VSAM file if you need to read it sequentially, simply use the PS file.
Reading the VSAM file sequentially simply write the READ FILE and then after read next for reading the next record
Back to top
View user's profile Send private message
ch.prashant

New User


Joined: 16 Sep 2006
Posts: 27
Location: Hyderabad

PostPosted: Tue Sep 15, 2009 4:59 pm
Reply with quote

I have used the code u suggested
FILE-CONTROL.
SELECT COTBL ASSIGN TO COTBL
RECORD KEY IS COT-KEY
ORGANIZATION IS INDEXED
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS COTBL-FILE-STATUS.
OPEN INPUT COTBL.
DISPLAY 'FILESTATUS= ' COTBL-FILE-STATUS
READ COTBL RECORD AT END MOVE 'Y' TO WS-COTBL-IND.
IF COTBL-FILE-STATUS NOT = '00'
DISPLAY 'FILESTATUS= ' COTBL-FILE-STATUS
END-IF.
CLOSE COTBL.

the output is the same
===========

FILESTATUS= 00
FILESTATUS= 92
COT-REC=



it still showing the same.
Back to top
View user's profile Send private message
ch.prashant

New User


Joined: 16 Sep 2006
Posts: 27
Location: Hyderabad

PostPosted: Tue Sep 15, 2009 5:01 pm
Reply with quote

Hi Ketan,

Here my file is a vsam file which i need to read for this step alone and this vsam file is used another step for index purpose so y to make complicate by converting it to falt file and read it and then repro it if we have the syntax of reading a vsam file.

Thanks ketan for ur suggestion.

Thanks,
Prashant
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: Tue Sep 15, 2009 5:02 pm
Reply with quote

ch.prashant: this is a help forum, not a do-your-job-for-you forum. You are presumed to be capable enough to write simple code to read a file; if you have specific issues we can help but that's about as far as we want to go.

Ketan Varhade: if the file already exists as a VSAM KSDS, which physical sequential (PS) file are you talking about in your last post? Nobody has mentioned any such file in this thread as far as I've seen.
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Tue Sep 15, 2009 5:04 pm
Reply with quote

Hi Robert,
I am talking about converting that file to a PS file not to process a VSAM file. I am asking the OP to use repro and simplify the process and complications
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Sep 15, 2009 5:31 pm
Reply with quote

Ketan Varhade wrote:
I am asking the OP to use repro and simplify the process and complications


why use resources (dasd) for another file,
when the only problem is the lack of technical expertise on the part of the TS?

Sequential reading of a vsam file is outlined in every version of the
COBOL Application Programmers Guide. Other than the Select clause,
the i/o commands are the same as reading a PS file.

and this 'give me the syntax for this' and 'give me the syntax for that'.
RTFM.
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: Tue Sep 15, 2009 5:55 pm
Reply with quote

Ketan: not a wise thing to do. If the file has 250 million records, you're talking about a lot of time to copy the file, a lot of space to hold the file, and it may not even be possible to copy it to a sequential file (depending upon the site). While changing the problem statement can simplify (considerably in some cases) the problem solution, the post usually would not have been made if such a change were possible. We need to work with what we're told, not change the problem to something else.
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: Tue Sep 15, 2009 6:05 pm
Reply with quote

The logic error usually means something is being attempted that cannot be done (such as opening an already open file, reading a file opened for output, writing a file opened for input, and so forth). How many records are in the VSAM file?

Your code is correct, so there's something about the file that is causing the logic error (or file and COBOL interaction). How was the file built?
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top