Enable/Disable Fieldtrim Option

PURPOSE:  The FIELDTRIM option controls whether or not trailing spaces are removed from the accessed values of character data.  This command is valid in a CM, PM, SF and as a direct command.

SYNTAX

{ENABLE; DISABLE} FIELDTRIM [{IF; UNLESS} clause]

ENABLE

removes trailing spaces from character data.  This is the default state.

DISABLE

leaves the trailing spaces in data.

{IF; UNLESS} clause

specifies certain criteria that must be met for the ENABLE or DISABLE command to take effect.

EXAMPLE

The following example shows the effect of FIELDTRIM on concatenated displays.  Note that ENABLE FIELDTRIM has the same effect as using the system function @RTRIM with each field name.  A free format picture could also be used to produce the same effect.

*USE DS PERS
*DISABLE FIELDTRIM
*EXTRACT SHOW LAST + ", " + 1B + FIRST + 1B + MIDDLE
VALDEVIA   ,   JOHN   CHARLES
*EXTRACT SHOW @RTRIM LAST,", ", 1B, @RTRIM FIRST, &
@RTRIM MIDDLE
VALDEVIA, JOHN CHARLES
*ENABLE FIELDTRIM
*EXTRACT SHOW LAST + ", " + 1B + FIRST + 1B + MIDDLE
VALDEVIA, JOHN CHARLES

NOTES:  This facility is particularly useful when identifying data with the ENDS WITH  relational string operator and when concatenating data.

FIELDTRIM affects only the accessed values, not the displayed values of character data.  Thus the effect of ENABLE FIELDTRIM is not apparent on values displayed with the TYPE command, the PRINT statement, or the SHOW clause (unless the data is concatenated as in the example).  The system function @RTRIM can be used to remove trailing spaces from individual fields or string expression values.

SEE ALSO:  Free Format Picture, and @RTRIM