Progress
Language Reference


+ Concatenation Operator

Interfaces
OS
SpeedScript
All
All
Yes

Produces a character value by joining two character strings or expressions.

SYNTAX

expression + expression 

expression

An expression whose value is a character string.

EXAMPLE

This procedure prints mailing labels. It uses the concatenation operator (+) to ensure that the third line of each label shows the city and state separated by a comma and a space. The FORMAT x(16) is specified to provide room for up to 16 characters in the result of the concatenation. If a FORMAT is not given, then Progress only displays the first eight characters of the result since x(8) is the default format for a character expression.

r-conc.p
FOR EACH customer:
  DISPLAY  SKIP(1) name SKIP address SKIP
    city + ", " + state FORMAT "x(16)" country postal-code SKIP(2).
END. 

This is a label produced by this procedure.

NOTE

If any of the string values you concatenate is unknown, then the result is the unknown value (?). This might lead to unexpected results if a field used in an expression is not mandatory. For example, you might have fields for a person’s first name, last name, and middle initial. You might combine these into a full name with an expression like the following.

DISPLAY fname + " " + minit + " " + lname FORMAT "x(36)". 

If minit is not a mandatory field, then in some records minit set to the unknown value (?). If so, these records are displayed as the unknown value. You can avoid this by using conditional code.

DISPLAY fname + " " + (IF minit <> ? THEN minit + ". " ELSE "") + 
        lname FORMAT "x(36)". 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095