• <Helps for GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • 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
        • Report Function (Deprecated)
        • SaveSetting Function
        • SetLanguage Function
        • SetProperty Function
        • SetReportData Function (Deprecated)
        • SetValueSet Function
        • SetValueSet Function With Arrays
        • 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
      • Export Attributes
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Appendix
  • <Helps for CSEntry>
  • <Helps for CSBatch>
  • <Helps for CSTab>
  • <Helps for DataViewer>
  • <Helps for TextView>
  • <Helps for TblView>
  • <Helps for TRSWin>
  • <Helps for CSDeploy>
  • <Helps for CSPack>
  • <Helps for CSFreq>
  • <Helps for CSSort>
  • <Helps for CSExport>
  • <Helps for CSReFmt>
  • <Helps for CSDiff>
  • <Helps for CSConcat>
  • <Helps for TRSSetup>
  • <Helps for ParadataViewer>
  • <Helps for ParadataConcat>
  • <Helps for CSIndex>
  • <Helps for Excel2CSPro>
  • <Helps for 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