Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
How to get out from a Do loop without its completion

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & ASSEMBLER
Author Message
hsbawari

New User


Joined: 16 Sep 2008
Posts: 8
Location: chennai

PostPosted: Fri Sep 19, 2008 6:11 pm    Post subject: How to get out from a Do loop without its completion
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
References
hsbawari

New User


Joined: 16 Sep 2008
Posts: 8
Location: chennai

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

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

Senior Member


Joined: 06 Jun 2008
Posts: 943
Location: Atlanta, GA

PostPosted: Fri Sep 19, 2008 6:25 pm    Post subject:
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: 3544
Location: Brussels once more ...

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

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

New User


Joined: 16 Sep 2008
Posts: 8
Location: chennai

PostPosted: Fri Sep 19, 2008 6:30 pm    Post subject:
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

Global Moderator


Joined: 23 Nov 2006
Posts: 8733
Location: 221 B Baker St

PostPosted: Fri Sep 19, 2008 10:16 pm    Post subject:
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

New User


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

PostPosted: Mon Sep 22, 2008 2:46 pm    Post subject:
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

Global Moderator


Joined: 23 Nov 2006
Posts: 8733
Location: 221 B Baker St

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

Hello,

This is the desired result, right?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & ASSEMBLER All times are GMT + 6 Hours
Page 1 of 1