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

How to get out from a Do loop without its completion


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
hsbawari
Currently Banned

New User


Joined: 16 Sep 2008
Posts: 9
Location: chennai

PostPosted: Fri Sep 19, 2008 6:11 pm
Reply with quote

I am using a DO loop in a program,
No I ahve also used a n If condition inside it so I wnat to get exit when a particular if condition is true so how do I do that.
Can a break statement be used to come out of the Do loop???
Back to top
View user's profile Send private message
hsbawari
Currently Banned

New User


Joined: 16 Sep 2008
Posts: 9
Location: chennai

PostPosted: Fri Sep 19, 2008 6:12 pm
Reply with quote

Its a PL/I program
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Sep 19, 2008 6:25 pm
Reply with quote

Try a LEAVE statement.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Sep 19, 2008 6:25 pm
Reply with quote

Have you tried it before posting ?
Back to top
View user's profile Send private message
hsbawari
Currently Banned

New User


Joined: 16 Sep 2008
Posts: 9
Location: chennai

PostPosted: Fri Sep 19, 2008 6:30 pm
Reply with quote

Cant really get wht u tryn to say..

I am new to PL/I

I just have this problem that I am stuck in a DO loop. I want to get out of it. In C and object oriented languages we have Break statement..

Do we have anything like this in Pl/I
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Sep 19, 2008 10:16 pm
Reply with quote

Hello,

Did you try LEAVE as Robert suggested?

What happened?
Back to top
View user's profile Send private message
murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Mon Sep 22, 2008 2:46 pm
Reply with quote

Quote:
DO ;
statement1 ;
statement2 ;
IF ITEM_1 = 5
THEN
LEAVE ;
statement3 ;
statement4 ;
END ;
statement5 ;


the LEAVE statement, if executed, transfers control to statement5.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Sep 22, 2008 7:53 pm
Reply with quote

Hello,

This is the desired result, right?
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. REXX - Do - Not able to LOOP CLIST & REXX 10
No new posts CSQBGET - Call giving completion code... COBOL Programming 3
No new posts REXX - Dataset checking in a do forev... CLIST & REXX 6
No new posts Need to read duplicate rows from tabl... DB2 3
This topic is locked: you cannot edit posts or make replies. Cobol db2 program going in loop COBOL Programming 4
Search our Forums:

Back to Top