How do I Stop a Single Step run through a Procedure

When Single Stepping through a procedure (via Cmd-D), how do I stop the running of the procedure? I tried the standard Command-. but in the Data Sheet of the file but that did not stop the procedure. It wants to continue as if the Procedure has not been stopped.

In Panorama X there is no way to terminate a procedure, whether you are single stepping or not.

Not being able to terminate a procedure is standard in most programming languages. Incorporating this ability has two drawbacks: 1) it slows down the program, because it must continuously check for the abort key, and 2) it makes it impossible to rely on a program running to the end. If a user can abort a procedure, they can leave a procedure in a half run state which can be a catastrophe.

This second reason is the really critical one. Decades ago when Panorama procedures were generally tiny it wasn’t a big deal to abort a procedure in the middle. Now, however, programmers create very complex Panorama code that must be reliable and the programmer must be able to count on their code running to the end, including tens of thousands of lines of code built-in to Panorama itself. Though the ability to abort a procedure is a nice convenience if you accidentally write an endless loop, I feel that the need for reliability overrides any possible convenience.

So, where does a Force Quit stand in all that? Perhaps it causes the same problems?

Sure, but you are unlikely to accidentally Force Quit. Sometimes people would press Command-Period accidentally, perhaps not even realizing what they were doing.

In any case, Force Quit is universal – it works with Panorama programs, Objective C programs, Swift programs, Python, whatever. It’s equivalent to pulling the plug on a program. When there is no other way to stop a program, that’s what you do. But yes, if the program (any program) is actually doing something at the exact moment the rug is pulled out from it, force quit or pulling the plug can cause preference or disk corruption, data loss, etc. That’s one reason why programs like disk repair tools exist.

It is possible to write something that would allow you to stop a procedure at certain points, that could be used for diagnosing problems, but you need to take them out when you are done. Displaydata will do that, and allow you to continue or quit depending on the button you press. It is handy for checking whether you have the correct data at a given point, and then continuing the procedure if everything is copacetic. I use it while writing and testing a procedure, and then remove it or comment it out when it runs correctly. If the data changes at some point, like when I am scraping web pages, commenting it out makes it easy to put it back if the page I am scraping changes.

I use displaydata that way very frequently, great tip.

I have always used the message statement which occasionally causes problems but allows you to continue. I didn’t know about the displaydata statement - thanks Bruce.