Here are some special considerations for using LIKE.
For example, if you did a search using the string pattern 'ABC%' in a varying length host variable, these are some of the values that can be returned:
'ABCD ' 'ABCDE' 'ABCxxx' 'ABC '
However, if you did a search using the search pattern 'ABC%' contained in a host variable with a fixed length of 10, these are some the values that can be returned assuming the column has a length of 12:
'ABCDE ' 'ABCD ' 'ABCxxx ' 'ABC '
Note that all returned values start with 'ABC' and end with at least six blanks. This is because the last six characters in the host variable were not assigned a specific value so blanks were used.
If you wanted to do a search using a fixed-length host variable where the last 7 characters can be anything, search for 'ABC%%%%%%%'. These are some values that can be returned:
'ABCDEFGHIJ' 'ABCXXXXXXX' 'ABCDE' 'ABCDD'