CLEAR Verb

Syntax

CLEAR {{EXCEPT} varlist}

Description

For BBj-specific information, see CLEAR Verb - BBj.

The CLEAR verb is one of the reset/initialize verbs in BBx. It first performs a RESET, then clears the current user data. See the RESET verb for additional information on the various levels of reset verbs.

Parameter

Description

EXCEPT

List of variables that are not to be cleared. It should be comprised of simple variables. ARRAY[ALL] and ARRAY$[ALL] are permitted to prevent an array from being cleared.

varlist

List of variables to be cleared. When CLEAR is used with just a variable, then only that variable is cleared from memory.

In public programs, you can execute a CLEAR before an ENTER statement without losing arguments passed to the public program. Executing a CLEAR after an ENTER has the following effect on arguments passed through the ENTER:

  • Call-by-value arguments are cleared like normal data.

  • Call-by-reference arguments lose their links to the CALLing program and are then cleared. You cannot send a value back to the CALLing program after the CLEAR has been performed. CLEAR does not affect the CALLing program's data unless the public program is sharing all data with the caller.

Examples

Example 1

The following illustrates the use of CLEAR in console mode:

CLEAR

Example 2

The following illustrates a simple CLEAR statement:

0100 CLEAR

Example 3

The following illustrates a CLEAR statement using the EXCEPT clause to exclude certain variables from the CLEAR:

0100 CLEAR EXCEPT TOTAL,PAGE_NUM,DATE$,J[ALL]

See Also

Verbs - Alphabetical Listing