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

Solve file status code 46


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sauraso
Warnings : 1

New User


Joined: 27 Feb 2010
Posts: 16
Location: usa

PostPosted: Tue May 04, 2010 4:07 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue May 04, 2010 4:16 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue May 04, 2010 5:06 pm
Reply with quote

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
View user's profile Send private message
sauraso
Warnings : 1

New User


Joined: 27 Feb 2010
Posts: 16
Location: usa

PostPosted: Tue May 04, 2010 5:25 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue May 04, 2010 5:29 pm
Reply with quote

well, let us start with a few pieces of information:
  1. JCL for step executing the cobol program
  2. select statements for file
  3. FD statements for file
  4. OPEN instruction
  5. code for your loop
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Tue May 04, 2010 5:30 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue May 04, 2010 5:36 pm
Reply with quote

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
View user's profile Send private message
sauraso
Warnings : 1

New User


Joined: 27 Feb 2010
Posts: 16
Location: usa

PostPosted: Tue May 04, 2010 5:43 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue May 04, 2010 5:50 pm
Reply with quote

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
View user's profile Send private message
sauraso
Warnings : 1

New User


Joined: 27 Feb 2010
Posts: 16
Location: usa

PostPosted: Wed May 05, 2010 5:28 pm
Reply with quote

Hi Robert Sample,

I have followed u logic.

BAD RECORD IN FILE - file status 92

guide me.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed May 05, 2010 5:41 pm
Reply with quote

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
View user's profile Send private message
sauraso
Warnings : 1

New User


Joined: 27 Feb 2010
Posts: 16
Location: usa

PostPosted: Wed May 05, 2010 5:46 pm
Reply with quote

how do i code in cobol program?
Back to top
View user's profile Send private message
icetigerfan

New User


Joined: 08 Mar 2010
Posts: 13
Location: Nuremberg, Germany

PostPosted: Wed May 05, 2010 6:16 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed May 05, 2010 6:35 pm
Reply with quote

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
View user's profile Send private message
sauraso
Warnings : 1

New User


Joined: 27 Feb 2010
Posts: 16
Location: usa

PostPosted: Thu May 06, 2010 6:59 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu May 06, 2010 7:11 pm
Reply with quote

File Status Clause
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: Thu May 06, 2010 8:55 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu May 06, 2010 9:00 pm
Reply with quote

"You can lead a horse to water...." icon_rolleyes.gif
Back to top
View user's profile Send private message
sauraso
Warnings : 1

New User


Joined: 27 Feb 2010
Posts: 16
Location: usa

PostPosted: Mon May 10, 2010 2:02 pm
Reply with quote

Hey Robert,

please find VSAM status below

VSAM-CODE ==> RETURN: 08 COMPONENT: 0 REASON: 044
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 May 10, 2010 4:49 pm
Reply with quote

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
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 How to split large record length file... DFSORT/ICETOOL 10
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
Search our Forums:

Back to Top