View previous topic :: View next topic
|
Author |
Message |
ch.prashant
New User
Joined: 16 Sep 2006 Posts: 27 Location: Hyderabad
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
ch.prashant
New User
Joined: 16 Sep 2006 Posts: 27 Location: Hyderabad
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
ch.prashant
New User
Joined: 16 Sep 2006 Posts: 27 Location: Hyderabad
|
|
|
|
Could u give me the synatx for reading file too |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
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 |
|
|
ch.prashant
New User
Joined: 16 Sep 2006 Posts: 27 Location: Hyderabad
|
|
|
|
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 |
|
|
ch.prashant
New User
Joined: 16 Sep 2006 Posts: 27 Location: Hyderabad
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
|