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
 
How to STOP infinite LOOP in REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Mon Jan 05, 2009 4:03 pm    Post subject: How to STOP infinite LOOP in REXX
Reply with quote

Hi,

How to stop infinite loop. This is the rexx code

Code:
/****REX****/
num=1
do forever
 say 'number 'num
 num=num+1
end


How the number is running. to stop this .....

right now i am terminating the entire ISPF session. How to stop the infinite loop without doing that.....


Sushanth
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10360
Location: italy

PostPosted: Mon Jan 05, 2009 4:18 pm    Post subject: Reply to: How to STOP infinite LOOP in REXX
Reply with quote

having to terminate Your ISPF session is just the right punishment for sloppy coding icon_biggrin.gif

when testing it is usually a good practice to have an additional constraint on do statements in order to avoid endless loops

the sample You posted is just bad code
add some test to terminate the loop icon_cool.gif
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Mon Jan 05, 2009 4:21 pm    Post subject:
Reply with quote

Try your ATTN (Attention) key.

O.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Mon Jan 05, 2009 4:30 pm    Post subject:
Reply with quote

Enrico,

Got the PUNISHMENT. So many windows closed. The Sloppy Code i posted, is what i typed & executed. I was trying how to break infinte loop.
From the manual,
Quote:
When you suspect an exec is in an infinite loop, you can end the exec by
pressing the attention interrupt key, sometimes labeled PA1. You will then see
message IRX0920I. In response to this message, type HI for halt interpretation
and press the Enter key. If that doesn't stop the loop, you can press the
attention interrupt key again, type HE for halt execution, and press the Enter key.


Ofer, the ATTN gets me to the region selection screen. There, when i choose ISPF, Again i get into the loop. Then Again, i pressed ATTN key, went to the region selection and i had to takedown the ISPF session.

Any ideas how to run HI or HE commands, where to run the commands ?

Sushanth
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8596
Location: Back in jolly old England

PostPosted: Mon Jan 05, 2009 4:38 pm    Post subject:
Reply with quote

If num > nnnnn THEN EXIT
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Mon Jan 05, 2009 4:41 pm    Post subject:
Reply with quote

You may hit HI or HE in the prompt after you hit ATTN... icon_lol.gif

I assume you are working under TPX or some other session management system. IIRC, you will have to change the settings of ATTN in your session management product to make it available under TSO.

O.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Mon Jan 05, 2009 4:49 pm    Post subject:
Reply with quote

Ofer,

Its not working.......

Sushanth
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8596
Location: Back in jolly old England

PostPosted: Mon Jan 05, 2009 4:52 pm    Post subject:
Reply with quote

Have you tried the Esc Key ?
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Mon Jan 05, 2009 5:04 pm    Post subject:
Reply with quote

Expat,

Another TAKEDOWN.

Sushanth
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2088
Location: Silicon Valley

PostPosted: Mon Jan 05, 2009 10:32 pm    Post subject: Reply to: How to STOP infinite LOOP in REXX
Reply with quote

Try defining a SIGNAL ON HALT routine prior to starting your loop.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Tue Jan 06, 2009 10:49 am    Post subject:
Reply with quote

Pedro,

SIGNAL ON HALT before the loop.

Code:
/**** REXX ************************************/
/* LOOP FOREVER                               */
/**********************************************/
NUM=1                                           
SIGNAL ON HALT                                 
DO FOREVER                                     
   SAY 'NUMBER 'NUM                             
   NUM=NUM+1                                   
END                                             


Also another take down
ATTN & ESC keys didn't work.

Sushanth
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2088
Location: Silicon Valley

PostPosted: Tue Jan 06, 2009 10:18 pm    Post subject: Reply to: How to STOP infinite LOOP in REXX
Reply with quote

Quote:
Try defining a SIGNAL ON HALT routine prior to starting your loop.


Please read my comment. I do not see where you defined a HALT routine in your program. If you do not understand, please read about SIGNAL in the rexx reference manual.
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Tue Jan 06, 2009 11:34 pm    Post subject:
Reply with quote

Hi Pedro I tried following code on my mainframe:

Code:

/* rexx */       
signal on halt   
do forever       
end             
exit             
halt:           
exit             


what key do i need to press to interrupt the program? I tried ctrl+c, Esc, PA1,PA2,PA3, all PF keys... is halt key system specific ?
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: Wed Jan 07, 2009 12:14 am    Post subject:
Reply with quote

Hello,

Is one of those mapped as your ATTN key?

The info here may also help:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ikj4a360/11.2.1.1?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10360
Location: italy

PostPosted: Wed Jan 07, 2009 12:32 am    Post subject: Reply to: How to STOP infinite LOOP in REXX
Reply with quote

looks like this topic is getting into a loop icon_biggrin.gif
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2088
Location: Silicon Valley

PostPosted: Wed Jan 07, 2009 1:31 am    Post subject: Reply to: How to STOP infinite LOOP in REXX
Reply with quote

With IBM's PCOMM emulator, you would right click to see a popup of special keys, including Attention.
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Rexx to send an email without SMTP Se... upendrasri All Other Mainframe Topics 6 Sun Nov 19, 2017 7:59 pm
This topic is locked: you cannot edit posts or make replies. ISREDIT Macro is not returning back t... nico_neoz CLIST & REXX 21 Sat Nov 18, 2017 7:40 pm
No new posts REXX LISTDSI () SMSINFO is not working upendrasri CLIST & REXX 4 Fri Nov 17, 2017 11:33 am
No new posts Calling IKJEFT01 program from Rexx upendrasri CLIST & REXX 4 Wed Nov 15, 2017 4:27 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am

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