View previous topic :: View next topic
|
Author |
Message |
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
having to terminate Your ISPF session is just the right punishment for sloppy coding
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 |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Try your ATTN (Attention) key.
O. |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
If num > nnnnn THEN EXIT |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
You may hit HI or HE in the prompt after you hit ATTN...
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 |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Ofer,
Its not working.......
Sushanth |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Have you tried the Esc Key ? |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Expat,
Another TAKEDOWN.
Sushanth |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Try defining a SIGNAL ON HALT routine prior to starting your loop. |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
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 |
|
|
genesis786
Active User
Joined: 28 Sep 2005 Posts: 210 Location: St Katherine's Dock London
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
looks like this topic is getting into a loop |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
With IBM's PCOMM emulator, you would right click to see a popup of special keys, including Attention. |
|
Back to top |
|
|
|