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

How to resolve File status 46?


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Tharak

New User


Joined: 22 May 2006
Posts: 2

PostPosted: Mon May 22, 2006 10:58 am
Reply with quote

Please help me fix COBOL File status code 46
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Mon May 22, 2006 6:20 pm
Reply with quote

Hi Tharak,

Look at your program again with the reason for File Status 46:

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:
1. The preceding READ statement was unsuccessful but did not cause an at end condition
2. The preceding READ statement caused an at end condition.

Cheers, Twissi.
Back to top
View user's profile Send private message
vijayamadhuri

Active User


Joined: 06 Apr 2005
Posts: 180

PostPosted: Tue May 23, 2006 12:06 am
Reply with quote

There is something wrong with u r i/p file.Check u r job to see if the lrec u have provided there and in the pgm are the same.
Back to top
View user's profile Send private message
Tharak

New User


Joined: 22 May 2006
Posts: 2

PostPosted: Tue May 23, 2006 2:17 am
Reply with quote

Hi Twissi,

Thanks for your quick reply....It worked....

Cheers
Tharak
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Tue May 23, 2006 2:03 pm
Reply with quote

Tharak,

No problem, I'm glad that it worked.

Vijayamadhuri, just for your information, if there's a mismatch between the LRECL in the program and the JCL, the file status will be 90.

Cheers, Twissi.
Back to top
View user's profile Send private message
rock23

New User


Joined: 19 Sep 2010
Posts: 1
Location: coimbatore

PostPosted: Fri Oct 15, 2010 3:13 pm
Reply with 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:

Quote:
° The preceding READ statement was unsuccessful but did not cause an
at-end condition.

° The preceding READ statement caused an at-end condition.


Causes of FILE STATUS Code 46:

File Not Opened for Output:
The file was not opened with an appropriate access mode that allows output operations, such as OUTPUT, EXTEND, or I-O.

Incorrect File Status Checking:
The program may not be checking the file status correctly after opening the file, leading to attempts to write to a file that is not open for output.

Steps to Resolve FILE STATUS Code 46:

Check File Open Statement:
Verify that the file in question is opened with an access mode that permits output operations, such as OUTPUT, EXTEND, or I-O.

Example:
Code:
OPEN OUTPUT file-name


Review File Status Checking:
Ensure that the program checks the file status after opening the file to confirm that it was opened successfully for output.

Example:
Code:
OPEN OUTPUT file-name
IF FILE-STATUS IS NOT ZERO
    DISPLAY "Error opening file for output"
    STOP RUN
END-IF


Verify File Definitions:

Double-check the file definitions in the COBOL program's FILE SECTION to ensure they match the actual file attributes and access modes.

File Existence and Permissions:
Make sure that the file exists and that the program has the necessary permissions to write to the file in the specified location.

Debugging Output Operations:
Use debugging techniques to trace the program's flow and identify the point where the FILE STATUS code 46 is triggered.

Test with Sample Data:
Create test scenarios with sample data to validate that the file opening and writing operations work as expected.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts IGYPG3178-I when compiling a pgm read... COBOL Programming 6
No new posts FileAid move data from two files to o... Compuware & Other Tools 5
No new posts Sorting date into YYYYMMDD, and creat... DFSORT/ICETOOL 13
No new posts To Sort detail records in a file with... SYNCSORT 5
No new posts To Populate Trailer cnt in the file w... SYNCSORT 1
Search our Forums:


Back to Top