Converting string lengths
The source string is assigned to the target string from left to right. If the source string is longer than the target, excess characters, bits, graphics, uchars, or widechars on the right are ignored, and the STRINGSIZE condition is raised. For fixed-length targets, if the target is longer than the source, the target is padded on the right. If STRINGSIZE is disabled, and the length of the source and/or the target is determined at run time, and the target is too short to contain the source, unpredictable results can occur.
'0'B,
graphic strings with DBCS blanks, uchar strings with
uchar blanks, and widechar strings with widechar blanks. declare Subject char(10);
Subject = 'Transformations';Subject, it truncates five characters
from the right end of the string. This is equivalent to executing
the following statement: Subject = 'Transforma';The first two of the following statements assign equivalent values
to Subject and the last two assign equivalent values
to Code:
Subject = 'Physics';
Subject = 'Physics ';
declare Code bit(10);
Code = '110011'B;
Code = '1100110000'B;
Subject: Subject = '110011'B;
Subject = '1100110000'B; Subject = '110011bbbb'; Subject = '1100110000';A string value is not extended with blank characters or zero bits when it is assigned to a string variable that has the VARYING or VARYING4 attribute. Instead, the length of the target string variable is set to the length of the assigned string. However, truncation will occur if the length of the assigned string exceeds the maximum length declared for the varying-length string variable.