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

read is going in indefinite loop


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

New User


Joined: 20 Oct 2006
Posts: 29

PostPosted: Thu Jan 09, 2014 10:14 pm
Reply with quote

Code:
START FILE-XXXX KEY IS >= WS-BUILD-Key
PERFORM UNTIL WS-EOF = 'Y'         
DISPLAY '0220-READ-FILE'                   
  READ FILE-TEMP                           
       AT END MOVE 'Y' TO WS-EOF
  NOT AT END                               
            MOVE FILE-TEMP-XXX TO P-XXX-REC
  END-READ     
END-PERFORM.         


Whats wrong with above statement?
The code is going in loop, the display ''0220-READ-FILE' is showing in loops.
Please help here.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Jan 09, 2014 10:26 pm
Reply with quote

Please use Code tags. Did you check the file status after your START?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jan 09, 2014 10:27 pm
Reply with quote

Hello,

If file-temp is read by a key and the key is not ever changed, it will read that record forever . . .
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Jan 09, 2014 10:34 pm
Reply with quote

Maybe you meant READ NEXT instead of READ?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jan 09, 2014 10:38 pm
Reply with quote

Good point Terry.

EVERY read/write/whatever should be followed by checking the file status.
Back to top
View user's profile Send private message
raviprabhu

New User


Joined: 20 Oct 2006
Posts: 29

PostPosted: Thu Jan 09, 2014 10:48 pm
Reply with quote

thanks this works with next record
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Jan 09, 2014 11:03 pm
Reply with quote

I wonder if this READ sans NEXT but with a NOT AT END clause generated a warning.
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 Error to read log with rexx CLIST & REXX 11
This topic is locked: you cannot edit posts or make replies. REXX - Do - Not able to LOOP CLIST & REXX 10
No new posts Random read in ESDS file by using RBA JCL & VSAM 6
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
No new posts ICETOOL to Read records SMF CEF it is... DFSORT/ICETOOL 4
Search our Forums:

Back to Top