BEGIN |
Reset Files and Variables |
BEGIN[ [ EXCEPT ] varlist | * ]
Where:
varlist An optional list of variables.
The BEGIN directive performs the following functions:
1. Closes all Local files currently open. (Global files remain open unless using BEGIN *).
2. Resets PRECISION to the default value of 2 (the value set in the 'PD' system 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 Example.
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 ability to use * to clear all global files/variables was added in PxPlus v7.10.)
CLEAR Reset 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
The following examples are from step 3 above:
3(a) begin
3(b) begin A3$,B3$,C3,D3
3(c) begin except CST_ID$,TX_VAL,TX_TBL${all}