The USUBSTR Function

The USUBSTR function returns a substring of the data in a character data item argument that contains UTF-8 or UTF-16 data. The type of this function depends on the argument as follows:
Argument Type Function Type
Alphabetic Alphanumeric
Alphanumeric Alphanumeric
National National
UTF-81 UTF-8

General Format


Must be alphabetic, alphanumeric, national, or UTF-8. argument-1 must contain valid UTF-8 or UTF-16 data based on its class:
  • If argument-1 is of class alphabetic, alphanumeric, or UTF-8, it must contain valid UTF-8 data.
  • If argument-1 is of class national, it must contain valid UTF-16 data.
Must be an integer that is greater than zero. It represents the starting position of a substring in argument-1.
Must be an integer that is greater than or equal to zero. It represents the length of a substring in argument-1.
Note: The sum of argument-2 and argument-3 minus one must be less than or equal to ULENGTH(argument-1).

If argument-2 = 3 and argument-3 = 2, the returned value is an alphanumeric character string that contains two UTF-8 or UTF-16 characters in argument-1, starting with the third character.

Return Value

The returned value is an string that is a substring (and same type) of argument-1.