Directives
CLEAR Reset Variables
   
Formats
1. Clear, Reset: CLEAR [ * ] [ [ EXCEPT ] varlist ]
2. Clear Composite String: CLEAR template$

Where:

template$ Name of a variable DIMensioned as a string template. String expression.
varlist An optional list of variables.
   
Description The CLEAR directive performs the following functions:

1. Resets PRECISION to the default value of 2 (the value set in the system 'PD' parameter.)

2. Clears local variables. (Global variables are not affected unless using CLEAR * )

a) All Variables if no varlist appears on directive.
b) Only those in varlist if no EXCEPT clause given
c) All but those in varlist if EXCEPT clause present.

(See examples below)

3. Sets ERR, RET, and CTL to zero.

4. Clears FOR/NEXT, GOSUB/RETURN, WHILE/WEND, etc .. stack.

5. Resets pointer to the first DATA item in the program.

  The CLEAR * directive also clears all global variables including those defined using the GBL function. CLEAR * will also accept an EXCEPT varlist clause to omit specific variables from being cleared.

The CLEAR * is a +PxPlus Exclusive feature



*Note* When executed within an object (in Object Oriented Programming), the CLEAR directive will clear all of the object's properties, along with standard variables.


   
See Also
BEGIN Reset Files and Variables, ERR( ) Test Error Value,
RESET Reset Program State, CTL Control Code: Key to End Input,
START Restart ProvideX, RET Operating System's Last Error Code
   
Format 1 Clear, Reset

CLEAR [EXCEPT] [varlist]

The examples here show, respectively, clearing all variables, clearing only a selected list of variables, and CLEARing all EXCEPT a selected list of variables:

0100 CLEAR
1100 CLEAR A3$,B3$,C3,D3
2100 CLEAR EXCEPT CST_ID$,TX_VAL,TX_TBL${ALL}

   
Format 2 Clear Composite String
Use this format to clear the attributes of a variable DIMensioned as a string template; e.g., CLEAR CUST$ or CLEAR CUST.NAME$. For more on string templates, see DIM Define Arrays and Strings.