Directives
BEGIN Reset Files and Variables
   
Format BEGIN [ [ EXCEPT ] varlist | * ]

Where:

varlist An optional list of variables.

   
Description The BEGIN directive performs the following functions:

1. Closes all Local files currently open. (Global files remain open unless using BEGIN * ).

Note: In closing all files, the main console window will be reset if the 'WK' System parameter is not on. The reset consists of dropping all windows and all non-global GUI controls. In addition the menu_bar is reset to its default "Enabled" state.

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

3. Clears local variables. (Global variables are not affected unless using BEGIN * )

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)

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

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

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

The BEGIN * directive also closes all global files and clears all global variables including those defined using the GBL function.

The BEGIN * is a +PxPlus Exclusive feature



*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, 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
   
Examples from '3' above
3a. 0100 BEGIN
3b. 0100 BEGIN A3$,B3$,C3,D3
3c. 0100 BEGIN EXCEPT CST_ID$,TX_VAL,TX_TBL${ALL}