Re: How to halt a running program without losing data?



<meek@xxxxxxxxxxxxxxx> wrote in message news:12JUL05.07143024@xxxxxxxxxxxxxxxxxx
> In a previous article, beliavsky@xxxxxxx wrote:
> >Random Programmer wrote:
> >
> >> Is there a Fortran command to get the program to pause if say Ctrl-C is
> >> hit and ask the user for a halt confirmation? I thought the best way
> >> might be to somehow change a variable that is stored in memory (e.g.
> >> iteration count), effectively "tricking" the program into thinking it
> >> has reached the end of it's calculations.

PL/I provides the ability to do this.
You can interrupt a program at any time, and can then do anything you
want, including printing the values of variables (useful if you want
to inspect the salient value of some iterative process to see whether
it is converging, etc), or reading in the values of any variables, etc.
You write what you want to do in an ON-unit (effectively
a procedure) that is entered when you interrupt from the keyboard.


.