CLEAR |
Reset Variables |
CLEAR[ *] [ [ EXCEPT ] varlist ] | |
CLEAR template$ |
template$ |
Name of a variable DIMensioned as a string template. String expression. |
varlist |
An optional list of variables. |
The CLEAR directive performs the following functions:
1. Resets PRECISION to the default value of 2 (the value set in the 'PD' system 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 Example.
3. Sets ERR, RET and CTL to zero.
4. Clears FOR/NEXT, GOSUB/RETURN, WHILE/WEND, etc. stack.
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 * directive was added in PxPlus v7.10.)
CLEAR [EXCEPT] [varlist]
Example:
The following examples show respectively clearing all variables, clearing only a selected list of variables, and CLEARing all EXCEPT a selected list of variables:
clear
clear A3$,B3$,C3,D3
clear except CST_ID$,TX_VAL,TX_TBL${all}
Clear Composite String
Use this format to clear the value(s) DIMensioned as a string template:
clear CUST$
or
clear CUST.NAME$
For information on string templates, see DIM Define Arrays and Strings.
BEGIN Reset Files and Variables
RESET Reset Program State
START Restart Session
ERR( ) Test Error Value
CTL Control Code: Key to End Input
RET Operating System's Last Error Code