Keep in mind the following when coding a RESET operation:
- RESET is not allowed for based variables and IMPORTed variables,
or for parameters in a subprocedure.
- The RESET operation results in an increase in the amount of storage
required by the program. For any variable that is reset, the storage
requirement is doubled. Note that for multiple occurrence data structures,
tables and arrays, the reset value of every occurrence or element
is saved.
- If a RESET occurs during the initialization routine of the program,
an error message will be issued at run time. If a GOTO or CABxx is
used to leave subroutine calculations during processing of the *INZSR,
or if control passes to another part of the cycle as the result of
error processing, the part of the initialization step which initializes
the save areas will never be reached. In this case, an error message
will be issued for all RESET operations in the program at run time.
- A RESET operation within a subprocedure to a global variable or
structure is valid in the following circumstances:
- If there is no *INZSR, it is always valid
- If there is a *INZSR, it is not valid until the *INZSR
has completed at least once. After that, it is always valid, even
if the cycle-main procedure is not active.
- Performing a RESET operation on a parameter of a *ENTRY
PLIST that does not get passed when the program is called may cause
unpredictable results. An alternative would be to save the parameter
value into a variable defined LIKE the parameter if the value returned
by %PARMS() indicates that the parameter is passed.
Attention!
When the RESET values are saved, a pointer-not-set error
will occur if the following are
all true in
a cycle module:
- There is no *INZSR
- An entry parameter to the cycle-main procedure
is RESET anywhere in the module
- A subprocedure is called before the cycle-main
procedure has ever been called
For more information, see CLEAR (Clear).