Resetting Values to Initial Values

You can reset the values of any data objects with the CLEAR statement as follows:

Syntax

CLEAR <f>.

This statement resets the contents of the data object <f> to its initial value. You can distinguish between

The system resets the values of variables to their initial values, not to the start value which you assigned with the VALUE parameter of the DATA statement. For a list of the initial values of data objects with elementary data types, see the table in Predefined Elementary Data Types. You cannot reset constants.

If you apply the CLEAR statement to a structure, the contents of the individual components are reset to their initial values.

For an explanation of how the CLEAR statement works with internal tables, see Initializing Internal Tables.

DATA NUMBER TYPE I VALUE '10'.

WRITE NUMBER.

CLEAR NUMBER.

WRITE / NUMBER.

The output appears as follows:

        10

         0

The CLEAR statement resets the contents of the field NUMBER from 10 to its initial value 0.