:CLEAR

The :CLEAR script statement resets a previously used script array to its initial values. The system deletes all existing values and reverts the array to its state immediately following its original declaration. For more information about declaring arrays, see :DEFINE.

Note: The :CLEAR statement only deletes the content of the array; it does not delete the variable itself. You cannot use :CLEAR to redefine the array's structure or size.

Syntax

:CLEAR Script array

Parameters

Parameter Format Description
Script array script variable

Variable name of the script array to reset.

Note: Specify the name of the script array using empty index brackets [].

Examples

The following example defines and fills an array with values from a line in a static VARA object. The script prints the values in the activation report. Subsequently, the script clears the array, fills it with values from a different line, and prints the new values in the report.

:DEFINE &ARRAY#, string, 5

:DEFINE &STR#, string

:FILL &ARRAY#[] = GET_VAR(VARA.STATIC.TEST,"KEY01")

:SET &STR# = ARRAY_2_STRING(&ARRAY#[])

:P "KEY01: &STR#"

:CLEAR &ARRAY#[]

:FILL &ARRAY#[] = GET_VAR(VARA.STATIC.TEST,"KEY02")

:SET &STR# = ARRAY_2_STRING(&ARRAY#[])

:P "KEY02: &STR#"

See also: