RESET [INITIAL ]
operand1
|
This document covers the following topics:
For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.
Related Statements: ADD | COMPRESS | COMPUTE | DIVIDE | EXAMINE | MOVE | MOVE ALL | MULTIPLY | SEPARATE | SUBTRACT
Belongs to Function Group: Arithmetic and Data Movement Operations
The RESET
statement is used to reset the value of a
field:
RESET
(without INITIAL
) sets the content of
each specified field to its default
initial value depending on its format.
RESET INITIAL
sets each specified field to the initial value as defined for the field in the
DEFINE DATA
statement. For a field declared without INIT
clause in the
DEFINE DATA
statement, RESET INITIAL
has the same
effect as RESET
(without INITIAL
).
Notes:
CONSTANT
clause in the
DEFINE DATA
statement may not be referenced in a
RESET
statement, since its content cannot be changed.
RESET
statement may also be
used to define a variable, provided that the program contains no
DEFINE DATA LOCAL
statement.
Operand Definition Table:
Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
operand1 | S | A | G | M | A | U | N | P | I | F | B | D | T | L | C | G | O | yes | yes |
Syntax Element Description:
RESET operand1 |
Reset to Null Value:
If operand1 is a dynamic variable, it
will be reset to a null value with the length the variable currently has at the
time the For general information on dynamic variables, see the section Using Dynamic and Large Variables. |
---|---|
RESET INITIAL operand1 |
Reset to Initial Value:
|
** Example 'RSTEX1': RESET (with/without INITIAL) ************************************************************************ DEFINE DATA LOCAL 1 EMPLOY-VIEW VIEW OF EMPLOYEES 2 NAME 1 #BINARY (B4) INIT <1> 1 #INTEGER (I4) INIT <5> 1 #NUMERIC (N2) INIT <25> END-DEFINE * LIMIT 1 READ EMPLOY-VIEW /* WRITE NOTITLE 'VALUES BEFORE RESET STATEMENT:' WRITE / '=' NAME '=' #BINARY '=' #INTEGER '=' #NUMERIC /* RESET NAME #BINARY #INTEGER #NUMERIC /* WRITE /// 'VALUES AFTER RESET STATEMENT:' WRITE / '=' NAME '=' #BINARY '=' #INTEGER '=' #NUMERIC /* RESET INITIAL #BINARY #INTEGER #NUMERIC /* WRITE /// 'VALUES AFTER RESET INITIAL STATEMENT:' WRITE / '=' NAME '=' #BINARY '=' #INTEGER '=' #NUMERIC /* END-READ END
VALUES BEFORE RESET STATEMENT: NAME: ADAM #BINARY: 00000001 #INTEGER: 5 #NUMERIC: 25 VALUES AFTER RESET STATEMENT: NAME: #BINARY: 00000000 #INTEGER: 0 #NUMERIC: 0 VALUES AFTER RESET INITIAL STATEMENT: NAME: #BINARY: 00000001 #INTEGER: 5 #NUMERIC: 25