Below code sometimes failing with vsam return code 46 and running fine with same data when i rerun it, can some one please help
READ FILE-NAME NEXT
AT END MOVE "Y" TO WS-EOF-FILE-NAME.
IF WS-FILE-STATUS-GOOD OR WS-FILE-STATUS-EOF
SET EOF-FILE-NAME TO TRUE
GO TO EXIT
DISPLAY "ERROR READING FILE-NAME STATUS CODE:" WS-FILE- STATUS
MOVE 16 TO RETURN-CODE
GO TO EXIT
Thanks for your quick respopnse, I know the meaning of file status 46 (failing while reading the file sequentially), hence I pasted my code also.
My code is failing rarely with file status 46, but i am unable to track why it failing, even I rerun the program the with same data in file it is not failing again, Can you please suggest, if something is wrong in my code thanks.
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
We can't answer that given only the code you posted. Are you checking the FILE STATUS after every I/O on your file? Opens, closes, reads, writes, etc.? I suspect you are attempting to read beyond end of file, but we can't tell from the code posted. Please use BBCode (see FAQ) for readability.