ProvideX V8.20 > Language Reference > 2. Directives
32
BEGIN Directive
            Reset Files and Variables
Format
BEGIN [[EXCEPT]varlist]
Where:
varlist List of variables. Optional.
Description
The BEGIN directive performs the following functions:
1. Closes all local files currently open (global files are not affected).
2. Closes all open windows (unless the 'WK' parameter is set), drops non-global
control objects, and resets the menu bar.
3. Clears local variables (global variables are not affected).
a) All 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.
Refer to the examples provided below.
4. Resets PRECISION to the default ('PD'=2) or value set via the 'PD'= System
Parameter, p.677.
5. Sets ERR, RET, and CTL to zero.
6. Clears the stack for FOR..NEXT, WHILE..WEND, GOSUB..RETURN, etc.
7. Resets pointer to the first DATA item in the program.
Note: When executed within an object (in Object Oriented Programming), the BEGIN
directive will clear all of the object's properties, along with standard variables, and will
close any standard local files and files owned by the object.
See Also
CLEAR Reset Variables, p.53,
RESET Reset Program State, p.286,
START Restart ProvideX, p.326,
ERR( ) Test Error Value, p.425,
CTL Control Signal, p.555,
RET Operating System's Last Error Code, p.569.
Examples
The following examples refer to item 3 in the description.
a)
0100 BEGIN
b)
0100 BEGIN A3$,B3$,C3,D3
c)
0100 BEGIN EXCEPT CST_ID$,TX_VAL,TX_TBL${ALL}