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

COBOL Loop Break like in c language


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

New User


Joined: 16 Jan 2006
Posts: 53
Location: pune

PostPosted: Fri Jan 27, 2006 6:13 pm
Reply with quote

Is there any verb in cobol which break the loop when some condition got satisfied just like in c language is BREAK

can we use refrence modifier with array element , if yes pls send me the syntax.
Back to top
View user's profile Send private message
itssreehere
Warnings : 1

New User


Joined: 10 Jan 2006
Posts: 65
Location: chennai

PostPosted: Fri Jan 27, 2006 6:33 pm
Reply with quote

1)i think 'next sentence' will take you out the loop.

2) yes you can use reference mod with rray elements.

array-item(index)(1:3)

Sreejith
Back to top
View user's profile Send private message
dipanshu

New User


Joined: 16 Jan 2006
Posts: 53
Location: pune

PostPosted: Fri Jan 27, 2006 7:14 pm
Reply with quote

NEXT and CONTINUE both have the same function , i know we can use GO TO verb for this problem but i m searching for alternative is there any?

Next is not possible dear.
Back to top
View user's profile Send private message
itssreehere
Warnings : 1

New User


Joined: 10 Jan 2006
Posts: 65
Location: chennai

PostPosted: Sat Jan 28, 2006 7:52 pm
Reply with quote

next sentence and continue are not the same. If there is only one loop both are same.If you are in a multiple loop next sentence will come out of all the loops, while continue will come out of the current loop. icon_biggrin.gif

Sreejith
Back to top
View user's profile Send private message
ankursanghi

New User


Joined: 19 Jul 2005
Posts: 4

PostPosted: Wed Feb 01, 2006 7:51 pm
Reply with quote

I don't think that even continue takes you out of the loop, it will just advance the loop further.

But in case of Next Sentence, it will take you after the first dot (.) that it encounters.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Feb 02, 2006 6:44 am
Reply with quote

Hi dipanshu,

The various PERFORM clauses should give what you need to break a loop. Read the COBOL Reference manual for the details.
Back to top
View user's profile Send private message
pghogan3

New User


Joined: 25 Jul 2006
Posts: 1

PostPosted: Tue Jul 25, 2006 4:11 am
Reply with quote

What would be the result of performing a paragraph-1 thru paragraph-2 (which has only the EXIT statement ) with paragraph-1 containing an in-line PERFORM including IF tests, some of which GO TO paragraph-2 ?

The current result seems to be that the program drops thru to the next line following the EXIT (as if it weren't set).
Back to top
View user's profile Send private message
chiranjeevi_mca

New User


Joined: 19 Feb 2006
Posts: 27

PostPosted: Thu Jul 27, 2006 11:10 am
Reply with quote

hi,

NEXT keyword beaks the loop.

CONTINUE will skip that time and once again transfer the control to the same loop once again
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top