For character assignment statements, the variable and expression must be of character type and have the same kind parameter.
The variable and expression can have different lengths. If the length of the expression is greater than the length of the variable, the character expression is truncated on the right. If the length of the expression is less than the length of the variable, the character expression is filled on the right with blank characters.
If you assign a value to a character substring, you do not affect character positions in any part of the character scalar variable not included in the substring. If a character position outside of the substring has a value previously assigned, it remains unchanged. If the character position is undefined, it remains undefined.
The following examples demonstrate valid and invalid character assignment statements. (In the valid examples, all variables are of type character.)
| ||Left element must be a character variable, array element, or substring reference.|
| ||Expression does not have a character data type.|
| ||Expression does not have a character data type. (Hollerith constants are numeric, not character.)|