Previous Topic: CapitalizationNext Topic: Cosine


Concatenate

The concatenate function returns the concatenation of a specified list of string values.

Syntax:

                         ┌──────────┐
►►─┬─ CON ─────────┬─ ( ─▼─ string ─┴─ ) ─────────────────────────────────────►◄
   ├─ CONCAT ──────┤
   └─ CONCATENATE ─┘

Invocation names:

CON
CONCAT
CONCATENATE

Parameters:

(string)

Specifies one or more string values that are concatenated to form a single string value.

Examples:

Concatenate fields

You can concatenate EMP-FIRST-NAME-0415 (PIC X(15)) and EMP-LAST-NAME-0415 (PIC X(15)) so the first name precedes the last name. EMP-FIRST-NAME-0415 is 'ELMER '. EMP-LAST-NAME-0415 is 'OTT '.

select concatenate(emp-first-name-0415, emp-last-name-0415)
 from employee

'ELMER          OTT            '

Concatenate and extract

You can use the concatenate function in conjunction with the extract function to concatenate EMP-FIRST-NAME-0415 (PIC X(15)), up to but not including the first blank, with a blank and then with EMP-LAST-NAME-0415 (PIC X(15)). The value of EMP-FIRST-NAME-0415 is 'ELMER ' and the value of EMP-LAST-NAME-0415 is 'OTT '.

select con(extract(emp-first-name-0415),' ',
 emp-last-name-0415) from employee

'ELMER OTT          '