The TRIM function returns a character string that trims the leading and/or trailing spaces from the argument supplied on input.
The type of this function depends on the argument type as follows:
Argument Type
|
Function Type
|
Alphabetic
|
Alphanumeric
|
Alphanumeric
|
Alphanumeric
|
National
|
National
|
UTF-8
|
UTF-8
|
General Format
Arguments
- argument-1 must be a data item of class alphabetic, alphanumeric, national, or UTF-8.
Returned Values
- If LEADING is specified, the returned value removes all space characters before the first leftmost character that is not
a space.
- If TRAILING is specified, the returned value removes all space characters after the rightmost character that is not a space.
- If neither LEADING nor TRAILING is specified, both of the above actions are performed.
- If
argument-1 contains all spaces or
argument-1 is of length zero, the returned value is of length zero.