• <Helps for GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
      • Introduction to CSPro Language
      • Data Requirements
      • CSPro Program Structure
      • Programming Standards
      • Code Folding
      • Debugging CSPro Applications
      • Declaration Section
      • Procedural Sections
      • Logic
      • Language Elements
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • CSPro Statements and Functions
    • 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>

CSPro Program Structure

CSPro logic consists of a collection of events defined as procedures. Each procedure performs the operations you specify using CSPro statements and functions written in the CSPro language. A CSPro program includes a declaration section and one or more procedural sections.
Declaration Section (PROC GLOBAL)
Declarations and definitions are defined in the global procedure. In this section you declare global variables, arrays, file handlers, and user-defined functions. The global procedure always appears at the beginning of the logic file and begins with the line "PROC GLOBAL." Except for within user-defined functions, there are no executable statements in this section. You can edit the PROC GLOBAL section by clicking on the topmost entry of the data entry edits tree or batch edits tree.
Example
PROC GLOBAL

// variables
numeric MinAgeDifferenceParent = 12,
        MaxAgeDifferenceMother = 
55;

string personName;
array validRelationships(5);

// user-defined function
function numeric IsMotherValidByAge(numeric motherAge, numeric childAge)
    IsMotherValidByAge = ( ( motherAge - childAge ) 
in MinAgeDifferenceParent:MaxAgeDifferenceMother );
end;
Procedural Section
This section contains executable and assignment statements that can be written before (preproc) or after (postproc) an event. Events always fall under the PROC section, which is followed by the name of the forms file, level, form, roster, or field. Statements are assumed to be in the postproc unless it is explicitly stated that they are in another procedure.
Data entry applications also have a forms file procedure. The form file preproc is executed before a data entry session begins. There are three other procedure types that may be useful in data entry applications: onfocus, killfocus, and onoccchange.
Example
PROC MYDICT_FF // form file procedure

preproc

   
// statements

PROC MYDICT_QUEST // level procedure

preproc

   
// statements

postproc

   
// statements

PROC HOUSING_FORM // form procedure

postproc

   
// statements

PROC INCOME // field procedure

   
// statements (implicitly in the postproc)
See also: Proc Statement, PreProc Statement, OnFocus Statement, OnOccChange Statement, KillFocus Statement, PostProc Statement, Order of Executing Data Entry Events, Order of Executing Batch Edit Events