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
 

 

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 SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts Submit job from Cobol with input data abdulrafi COBOL Programming 4 Wed Feb 01, 2017 12:41 pm
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am


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