View previous topic :: View next topic
|
Author |
Message |
sauraso Warnings : 1 New User
Joined: 27 Feb 2010 Posts: 16 Location: usa
|
|
|
|
I am trying to read VSAM file sequentially in COBOL program. After certain number of records, i am getting file status as 46. In fact there are more records in file.
Could you please help me. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
ESDS or KSDS.
Via AIX or not via AIX.
How do you know that there are more records available.
What status checking does your program have.
Just a couple of minor details that might help get a solution, I'm sure there's a whole lot more that you could have told us too. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
i am getting file status as 46. In fact there are more records in file.
|
So what? A 46 does not always mean you hit end of file, so go read the manual and research the 46 file status code. |
|
Back to top |
|
|
sauraso Warnings : 1 New User
Joined: 27 Feb 2010 Posts: 16 Location: usa
|
|
|
|
READ TRANMST
AT END
MOVE "Y" TO END-OF-FILE.
I used above code to track end of file but it is going in infinite loop. so i used below code
READ TRANMST
IF T1-STATUS = '46'
MOVE "Y" TO END-OF-FILE
END-IF.
In above case program is getting terminated before reading all records.
File is KSDS. I have to read this file sequentially. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
well, let us start with a few pieces of information:- JCL for step executing the cobol program
- select statements for file
- FD statements for file
- OPEN instruction
- code for your loop
|
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
What Robert said:
A 46 does not always mean you hit end of file, so go read the manual and research the 46 file status code. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
From the COBOL Language Reference manual, section 6.1.8.9.1 on file status key:
Quote: |
A sequential READ statement was attempted on a file open in the input
or I-O mode and no valid next record had been established because:
° The preceding READ statement was unsuccessful but did not cause an
at-end condition.
° The preceding READ statement caused an at-end condition. |
So is your code checking for specific conditions and ignoring the error you're getting? |
|
Back to top |
|
|
sauraso Warnings : 1 New User
Joined: 27 Feb 2010 Posts: 16 Location: usa
|
|
|
|
If The preceding READ statement was unsuccessful but did not cause an
at-end condition. This might be case.
how do i check it??? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
If The preceding READ statement was unsuccessful but did not cause an at-end condition. This might be case. |
Precisely my point.
After your READ statement, your code should be something along the lines of
Code: |
IF T1-STATUS NOT = '00'
AND T1-STATUS NOT = '10'
DISPLAY 'BAD READ FILE STATUS = ' T1-STATUS
.
.
.
END-IF
|
|
|
Back to top |
|
|
sauraso Warnings : 1 New User
Joined: 27 Feb 2010 Posts: 16 Location: usa
|
|
|
|
Hi Robert Sample,
I have followed u logic.
BAD RECORD IN FILE - file status 92
guide me. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Code: |
| >__ ________________________________________________________ __.______________________________>< |
| |_ ______ __STATUS__ ____ __data-name-1__ _____________ _| |
| |_FILE_| |_IS_| |_data-name-8_| | |
Add "data-name-8" to your file status clause and display it after the bad open. |
|
Back to top |
|
|
sauraso Warnings : 1 New User
Joined: 27 Feb 2010 Posts: 16 Location: usa
|
|
|
|
how do i code in cobol program? |
|
Back to top |
|
|
icetigerfan
New User
Joined: 08 Mar 2010 Posts: 13 Location: Nuremberg, Germany
|
|
|
|
It is something like that:
******************************
INPUT-OUTPUT SECTION.
******************************
FILE-CONTROL.
*
SELECT .... ASSIGN TO .... STATUS IS data-name1 data-name-8.
data-name8 will be filled with non zero when ...
The description is located in the Language Reference for Enterprise Cobol. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Logic error can be dissected by using the VSAM file status field. The FILE STATUS IS in the SELECT has an added field. WORKING-STORAGE fields are
Code: |
05 VSAM-FILE2-FS PIC 9(02).
05 VSAM-FILE2-FULL.
10 VF02-RETURN PIC S9(04) COMP.
10 VF02-FUNCTION PIC S9(04) COMP.
10 VF02-FEEDBACK PIC S9(04) COMP. |
and you'll want to display all three fields on the 92 file status to get as much detail as possible. |
|
Back to top |
|
|
sauraso Warnings : 1 New User
Joined: 27 Feb 2010 Posts: 16 Location: usa
|
|
|
|
How do i will get value in VSAM-FILE2-FULL??
SELECT TRANMST ASSIGN TO TRANSI
FILE STATUS IS ???????
ORGANIZATION IS INDEXED
RECORD KEY IS TR-KEY
ACCESS IS SEQUENTIAL. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
What is your problem with reading the manual? The link at the top of the page is quite simple to reach. The syntax for the full file status statement has even been pulled out of the manual and presented to you in an earlier post, so there is no excuse for you not knowing what to put in your FILE STATUS IS clause. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
"You can lead a horse to water...." |
|
Back to top |
|
|
sauraso Warnings : 1 New User
Joined: 27 Feb 2010 Posts: 16 Location: usa
|
|
|
|
Hey Robert,
please find VSAM status below
VSAM-CODE ==> RETURN: 08 COMPONENT: 0 REASON: 044 |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
You have to look in the DFSMS Macro Instructions for Data Sets manual to get the feedback code details:
Code: |
| 44(X'2C') | Work area not large enough for the data record or |
| | for the buffer (GET with OPTCD=MVE). | |
|
|
Back to top |
|
|
|