How to join two strings with two variables

This code below does not work?

DISPLAY "You are, " WS-CUSTOMER-NAME. "And your age is ", WS-AGE.

Can somebody fix it with proper codes?

1 Like

I don’t have a way to test this but I noticed you have a comma outside the 2nd quote. Why not try …"And your age is, " WS-AGE. ? DID THAT WORK?
My preference would be to just omit the commas from both your quotations.

DISPLAY "You are, " WS-CUSTOMER-NAME " And your age is , " WS-AGE.

Above solution should work, but depending on compiler settings you may have to use a single quote.

BTW when Iam trying to post a question I am not able to. Does anyone knows why?

1 Like

Tried it but the same only.

Thanks Gersen, let me try this fixed.

Looks like you have a “period” [i.e., the “.”] after WS-CUSTOMER-NAME. That “period” should be a “comma” [i.e., the “,”], or (in the compiler I used, on another machine) nothing.

The “period” ends the statement. So, the compiler will see that “period”; and will look for a verb or a “conditional”, etc., that can serve as the beginning of the next statement.

Seeing only a string and a variable, where a “reserved word” should be, the code will not compile.