Purpose
Returns the concatenation of a specified list of string values.
Syntax
┌─── , ────┐ ►►─┬─ CONCATENATE ─┬─ ( ─▼─ string ─┴─ ) ─────────────────────────────────────►◄ ├─ CONCAT ──────┤ └─ CON ─────────┘
Parameters
Specifies one or more string values that are concatenated to form a single string value.
String can be:
Example 1: Using the concatenate function only
In the following example, the concatenate function is used to concatenate EMP-FNAME (PIC X(15)) and EMP-LNAME (PIC X(15)) so that the first name precedes the last name:
Initial values:
EMP-FNAME: 'JOE '
EMP-LNAME: 'SMITH '
Statement:
MOVE CONCATENATE(EMP-FNAME,EMP-LNAME) TO WK-NAME.
Returned string:
'JOE SMITH '
Example 2: Using the concatenate function with the extract function
In this example, the concatenate function is used in conjunction with the extract function to concatenate EMP-FNAME (PIC X(15)), up to but not including the first blank, with a blank and then with EMP-LNAME (PIC X(15)):
Initial values:
EMP-FNAME: 'JOE '
EMP-LNAME: 'SMITH '
Statements:
MOVE CON(EXTRACT(EMP-FNAME),' ',EMP-LNAME) TO WK-NAME.
Returned string:
'JOE SMITH '
Another example of the concatenate function is provided in SUBSTRING.
|
Copyright © 2014 CA.
All rights reserved.
|
|