Variables and control structures

The contents of a document may differ, based on parameters such as gender.

... 
Dear # 
IF Cust.Sex = "M" THEN # Mr. # 
ELIF Cust.Sex = "F" THEN # Ms. # 
ELSE # Ms. or Mr. # 
FI 
# @(Cust.Surname), 
In reference to your writing... 

Use of variables facilitates the process of composing the document.

... 
TEXT ms_mr 
IF Cust.Sex = "M" THEN 
ASSIGN ms_mr := "Mr." 
ELIF Cust.Sex = "F" THEN 
ASSIGN ms_mr := "Ms." 
ELSE 
ASSIGN ms_mr := "Ms. or Mr." 
FI 
# 
Dear @(ms_mr) @(Cust.Surname), 
In reference to your writing... 

In the second example, a variable of type TEXT is declared. KCM assigns a value to the variable based on the contents of the field. The contents of the variable is merged into the text using the @ construct.