You can use the underscore (_) to specify a character string that ignores a given number of characters. Use a specific number of underscores to specify the same number of characters that are to be ignored in the search. For example,
WHERE PARTNO LIKE '_G2044_ _'
is used to search a column of eight character part numbers for the combination "G2044" occurring in positions 2 through 6. The first and last two characters are ignored.
OS/390 requires single quotes around an all-digit value.
Examples:
SELECT ID, NAME FROM Q.STAFF WHERE NAME LIKE '_%S%'
SELECT ID, NAME FROM Q.STAFF WHERE NAME LIKE '%SON'
This example works because the NAME column has data type VARCHAR, which has no blanks following it in the database. If a column has data type CHAR, with a fixed width, the query has to anticipate all lengths of names ending in SON, and has to include those combinations in the search value.