"From" and "To" strings of different lengths

For character columns (CHAR, VARCHAR), you can specify from and to strings (from_string and to_string) of different lengths, subject to the following conditions:

  • For fixed-length character columns, when the to string (to_string) is shorter than the from string (from_string), FM/Db2 performs the change and pads the column with spaces. When the to string (to_string) is longer than the from string (from_string), FM/Db2 performs the change only if there are enough unused characters in the column to accommodate the change.
    For example, for a given row, if column #2 is a fixed-length, character column of length 8 containing GEORGE   (with two trailing spaces):
    CHANGE GEORGE FRED #2
    Changes GEORGE   (with two trailing spaces) to FRED     (with four trailing spaces) in that row.
    CHANGE GEORGE WILLIAM #2
    Changes GEORGE   (with two trailing spaces) to WILLIAM  (with one trailing space) in that row.
    CHANGE GEORGE ALEXANDER #2
    FM/Db2 does not perform the change to that row as there are not enough unused characters in the column to accommodate the change.
  • For varying-length character columns, when the to string (to_string) is shorter than the from string (from_string), FM/Db2 performs the change and adjusts the length of the column downwards by the difference between the lengths of to_string and from_string. When the to string (to_string) is longer than the from string (from_string), FM/Db2 performs the change only if there are enough unused characters in the column to accommodate the change. In this case, FM/Db2 adjusts the length of the column upwards by the difference between the lengths of from_string and to_string.