Command Levels

Command levels are environments defining the scope of local symbols.

While typing commands at your terminal, you are at command level 0. When you execute a command procedure directly from the DCL prompt, it executes at command level 1. If that procedure executes another procedure, the second procedure will be at command level 2, and so forth. When each procedure ends, you return to the previous command level. So, when you arrive back at the DCL prompt, you are back at command level 0. There are 32 command levels.

Using the CALL command in a command procedure (discussed later in this chapter) also increases the command level for the duration of the subroutine.

Remember that each command level has a separate set of local symbols, but global symbols are accessible from all command levels. Within a command level, local symbols take precedence over global symbols of the same name. (See "DCL Symbols", "Symbol Scope" in Chapter 6, "The Digital Command Language.")

Local symbols defined at one command level are visible at higher-numbered command levels, but modifications to them are restricted to that command level. For example, if you create a local symbol at the DCL command level and then execute a procedure, the symbol will be present in the command procedure. If you modify the value of the symbol from within the procedure, it will revert to its original value when the procedure ends.

In the following example, the DCL prompt has been changed to DCL> to differentiate commands typed at the DCL prompt from the lines in the command procedure:

    DCL> SET VERIFY ! From DCL command level    DCL> TESTVAL = 10    DCL> @SHOW_TESTVAL    $ !    $ ! Command procedure SHOW_TESTVAL begins...    $ !    $ write sys$output "Testval: ''testval'"    Testval: 10    $ TESTVAL = 1000    $ write sys$output "Testval: ''testval'"    Testval: 1000    $ !    $ ! Command procedure SHOW_TESTVAL ends...    $ !    $ exit    DCL> write sys$output "Testval: ''testval'" ! Back at the DCL prompt    Testval: 10 



Getting Started with OpenVMS(c) A Guide for New Users
Getting Started with OpenVMS: A Guide for New Users (HP Technologies)
ISBN: 1555582796
EAN: 2147483647
Year: 2005
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net