Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 1238
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: 19270
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: 1238
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: 19270
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: 961
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 CICS VSAM RLS READ akodakka CICS 3 Tue Oct 04, 2016 3:09 pm
No new posts save SAY var loop. italo_pm CLIST & REXX 3 Sun Sep 04, 2016 3:06 am
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am
No new posts To read from Zeke scheduler p.anbuselvan CLIST & REXX 5 Thu Mar 31, 2016 1:13 am
No new posts How to read a excel sheet and load it... Radhika Nambiar Java & MQSeries 10 Wed Mar 30, 2016 4:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us