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.
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;
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.
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)