CONCAT: Concatenating Strings After Removing Trailing Blanks From the First

How to:

CONCAT removes trailing blanks from a string and then concatenates another string to it. The output is returned as variable length alphanumeric.

Syntax: How to Concatenate Strings After Removing Trailing Blanks From the First

CONCAT(string1, string2)

where:

string2

Alphanumeric

Is a string whose trailing blanks will be removed.

string1

Alphanumeric

Is a string whose leading and trailing blanks will be preserved.

Example: Concatenating Strings After Removing Blanks From the First

The following request concatenates city names with state names. Note that the city and state names are converted to fixed length alphanumeric fields before concatenation.

DEFINE FILE WF_RETAIL_LITE
CITY/A50 = CITY_NAME;
STATE/A50 = STATE_PROV_NAME;
CONCAT_CS/A100 = CONCAT(CITY,STATE);
END  
 
TABLE FILE WF_RETAIL_LITE
SUM CITY AS City STATE AS State CONCAT_CS AS Concatenation
BY STATE_PROV_NAME NOPRINT
WHERE COUNTRY_NAME EQ 'United States'
WHERE STATE LE 'Louisiana'
ON TABLE SET PAGE NOLEAD
END

The output is shown in the following image.