Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
COBOL Loop Break like in c language

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: COBOL Loop Break like in c language
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    Post subject:
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    Post subject:
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    Post subject: Re: COBOL Loop Break
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    Post subject:
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    Post subject:
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    Post subject: What about GO TO out of an inline perform ?
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    Post subject: Re: COBOL Loop Break
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    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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm

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