The
stop function prematurely ends a CSPro application. The optional numeric expression
stop_code determines how the program ends. If not specified, the code defaults to 0.
If the function is used in a data entry application, the stop code determines whether data entry is stopped just for the current case or whether the entire data entry application is closed. If the code is 0, entry of the current case is stopped but CSEntry remains active, which is the same behavior as pressing the stop button. If the code is 1, entry of the current case is stopped and CSEntry terminates. If the function is executed in the
postproc of the first (highest) level, then the data for the case is saved. Otherwise, any data entered for the current case is lost. If you want to avoid losing data, you can call
savepartial just before the
stop function.
If the function is used in a batch edit application, the run is always terminated. If an output file was specified in the batch run, neither the current case nor subsequent cases will be saved to the output file. If the code is not 1, the application postproc will be executed, which allows you to execute tasks like writing summary information to a listing file. This is as if you terminated the batch run using the Cancel button. If the code is 1, the application postproc is not executed.
The function returns a logical value of 0 (false) if the program cannot be stopped (for example, if the function is called from an external form). Otherwise the function returns 1 (true).