trim (default all)

The trim option is used for DATA-GEN, DATA-INTO and XML-INTO.

The trim option specifies whether whitespace (blanks, newlines, tabs etc.) should be trimmed from text data before the data is assigned to RPG variables for the XML-INTO and DATA-INTO operations, and whether blanks should be trimmed from the data from character, UCS-2 and graphic RPG variables before the data is passed to the generator for the DATA-GEN operation.

  • all indicates that all data will be trimmed.
  • none indicates that no data will be trimmed.

Details of the 'trim' option for XML-INTO and DATA-INTO

  • If 'trim=all' is specified, then before text content is assigned to the RPG character or UCS-2 variable, the following steps will be done:
    1. Leading and trailing whitespace will be trimmed completely from text content
    2. Strings of interior whitespace in the text content will be reduced to a single blank
  • If 'trim=none' is specified, no whitespace will be trimmed from text content. This option will have the best performance, but it should only be used if the whitespace is wanted, or if the data is known to contain no unwanted whitespace, or if the RPG program is going to handle the removal of the whitespace itself.
Note:
  1. Whitespace includes blank, tab, end-of-line, carriage-return, and line-feed.
  2. This option applies only to data that is to be assigned to character and UCS-2 RPG variables. Trimming of whitespace is always done for other data types.
  3. This option is mainly provided for data from files, but it also applies to data from a variable.
  4. For the XML-INTO operation, whitespace between XML elements is always ignored. The trim option controls the whitespace within text content of elements and attributes.