Clear

From Br Wiki
Jump to: navigation, search

The Clear command deletes a program and data from memory and/or closes any active procedure files. It is useful for ensuring that memory is empty before you begin typing in a new program.

Syntax

CLEAR {[ PROC [ONLY]]|[RESIDENT [STATUS]]|[<resident library> [STATUS]]|[ALL]}

Clear.png

Comments and Examples

If a BR program is active in memory when you type CLEAR ALL and press <ENTER>, its files are closed and the program terminates. Memory space is cleared for you to begin entering new program lines.

The following are examples of the CLEAR command:

CLEAR ALL
CLEAR PROC
CLEAR PROC ONLY
CLEAR RESIDENT
CLEAR RESIDENT STATUS
CLEAR "resident-library-name"
CLEAR "resident-library-name" STATUS

Defaults

  1. Clear main program from memory, leave active procedure files and resident library programs open, and prepare for program entry.
  2. Close all active procedure files and end program.
  3. Clear the specified resident libraries from memory

Parameters

ALL terminates the current program, closes all active procedure files and clears memory.

When PROC is the only parameter used with the CLEAR command, it also closes all active procedure files, but it leaves memory intact, thus variable values are still available for debugging.

When the PROC and ONLY parameters are specified together, BR closes all active procedure files but it does not end the current program and it leaves memory intact with all variable values still available.

The RESIDENT parameter indicates that the CLEAR operation is to be performed on all libraries currently loaded resident. When this parameter is not followed by the STATUS parameter, BR clears all resident libraries from memory. Note that if any linkages are active for any of the libraries, an error will result when this operation is attempted. If the STATUS parameter is included, then the resident libraries are demoted from resident status to present status.

The resident library name parameter indicates that the CLEAR operation is to be performed on the specified library. When this parameter is not followed by the STATUS parameter, BR clears the specified resident library from memory. Note that if any linkages are active for any of the libraries, an error will result when this operation is attempted. If the STATUS parameter is included, then the named resident library is demoted from resident status to present status.

Technical Considerations

BR performs an implicit CLEAR whenever the CHAIN statement or the LOAD command are executed.

The CLEAR command handles the following library-related tasks:

  1. Clear a named resident library from memory.
  2. Clear all resident libraries from memory.
  3. Remove the resident status of a named library, turning it into a present library.
  4. Remove the resident status of all resident libraries, turning them all into present libraries.