Enable/Disable Datatrim Option

PURPOSE:  This ENABLE/DISABLE option allows field checking with the character (CHAR) or ALPHABETIC data types for nulls, trailing spaces, and other binary data.  This option is useful when working with unusual data types within a Process Module (PM) or at command level.  This command is valid in a CM, PM, SF and as a direct command.

SYNTAX

{ENABLE/DISABLE} DATATRIM [{IF; UNLESS} clause]

ENABLE

invokes field checking to trim ASCII data (such as trailing spaces or nulls) from character or alphabetic fields.  This is the default state.

DISABLE

deactivates field checking.

{IF; UNLESS} clause

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

NOTES:  Disabling DATATRIM is especially useful when manipulating primary fields which have associated secondary fields.  In some situations, assigning character values to subfields will result in other subfields appearing to be empty when the entire primary field is examined.  Disabling DATATRIM will cause the subfields to be visible when the primary record is examined.

When DATATRIM is ENABLED, field access terminates with a NULL in character or alphabetic data.  The state of ENABLE/DISABLE FIELDTRIM determines whether trailing spaces will be dropped.  When DATATRIM is DISABLED, the state of FIELDTRIM is not checked, and the "value" of a field will include any nulls, trailing spaces, and other miscellaneous "binary" data.  The easiest way to "see" the results of DATATRIM is to use the @LEN function on @STRING (e.g. TYPE @LEN @STRING).

Using a data field before anything has been stored into it when DATATRIM is DISABLED will cause unpredictable results (especially for system fields whose default values in many cases are nulls).  Sort keys, matching keys, index keys and TOTAL Section control fields (in Process Modules) are sensitive to the DATATRIM state.