ENTMF 

The TRIM Function

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

Syntax for General Format for the TRIM function

Arguments

  1. argument-1 must be a data item of class alphabetic, alphanumeric, national, or UTF-8.

Returned Values

  1. If LEADING is specified, the returned value removes all space characters before the first leftmost character that is not a space.
  2. If TRAILING is specified, the returned value removes all space characters after the rightmost character that is not a space.
  3. If neither LEADING nor TRAILING is specified, both of the above actions are performed.
  4. If argument-1 contains all spaces or argument-1 is of length zero, the returned value is of length zero.