Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
read is going in indefinite loop

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: read is going in indefinite loop
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    Post subject:
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

Site Director


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

PostPosted: Thu Jan 09, 2014 10:27 pm    Post subject:
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    Post subject:
Reply with quote

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

Site Director


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

PostPosted: Thu Jan 09, 2014 10:38 pm    Post subject:
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    Post subject:
Reply with quote

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

Active Member


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

PostPosted: Thu Jan 09, 2014 11:03 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts KSDS direct READ clause after READ NEXT sophia.lee JCL & VSAM 0 Tue Oct 01, 2019 10:10 am
No new posts How to force PULL to read user-input ... Andi1982 CLIST & REXX 5 Thu May 09, 2019 6:27 pm
No new posts Need suggestion on CICS READ UPDATE subratarec CICS 8 Fri May 03, 2019 2:23 pm
No new posts Suggestion on KSDS VSAM READ in CICS subratarec CICS 5 Wed Feb 13, 2019 4:42 pm
No new posts Need to loop & extract from varia... pkmurali CLIST & REXX 2 Thu Jan 10, 2019 11:42 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us