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
 

 

How to get out from a Do loop without its completion

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    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

hsbawari
Currently Banned

New User


Joined: 16 Sep 2008
Posts: 9
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

Global Moderator


Joined: 06 Jun 2008
Posts: 7988
Location: Bellevue, IA

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: 8593
Location: Back in jolly old England

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
Currently Banned

New User


Joined: 16 Sep 2008
Posts: 9
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

Site Director


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

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

Active User


Joined: 31 Jan 2008
Posts: 148
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

Site Director


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

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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts save SAY var loop. italo_pm CLIST & REXX 3 Sun Sep 04, 2016 3:06 am
No new posts print out the correct info in LOOP? jackzhang75 CLIST & REXX 7 Wed Dec 23, 2015 10:39 pm
No new posts Using different values for Skeleton d... venksiv CLIST & REXX 8 Thu Sep 03, 2015 5:28 pm
No new posts Issue with Do Loop. santosh_g CLIST & REXX 5 Tue May 12, 2015 9:24 am
No new posts A cursor within a multi-fetch cursor ... Rohit Umarjikar DB2 1 Thu Mar 06, 2014 9:43 am


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