• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
        • Compress Function
        • Decompress Function
        • diagnostics Function
        • Encode Function
        • ErrMsg Function
        • ExecSystem Function (Desktop)
        • ExecSystem Function (Mobile)
        • ExecPFF Function
        • GetProperty Function
        • GetLabel Function
        • GetLanguage Function
        • GetSymbol Function
        • GetValueLabel Function
        • hash Function
        • htmldialog Function
        • InValueSet Function
        • Invoke Function
        • IsChecked Function
        • loadsetting Function
        • LogText Function
        • MaxValue Function
        • MinValue Function
        • paradata Function
        • PathConcat Function
        • PathName Function
        • savesetting Function
        • SetLanguage Function
        • SetProperty Function
        • SetValueSet Function
        • SetValueSets Function
        • Special Function
        • sqlquery Function
        • Stop Function
        • SysParm Function
        • tr Function
        • Trace Function
        • UUID Function
        • View Function
        • Warning Function
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Stop Function

Format
b = stop(ʃstop_codeʅ);
Description
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.
Return Value
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).
Data Entry Example
if VALUE = 99 then
   
savepartial();
   
stop(1);
endif;
Batch Edit Example
if number_total_errors > 100 then
   
stop();
endif;
See also: EndCase Statement, Skip Case Statement