Compaq AA-PWCBD-TE Computer Accessories User Manual


 
Lexical Elements of the DEC Text Processing Utility Language
4.5 Variables
The global variable user_tab_char is assigned a value when the procedure
user_tab is executing. Since the variable is a global variable, it could have been
assigned a value outside the procedure user_tab.
The local variable this_mode has the value established in the procedure user_tab
only when this procedure is executing. You can have a variable also named
this_mode in another procedure. The two variables are not the same and may
have different values. You can also have a global variable named this_mode.
However, using this_mode as a global variable when you are also using it as a
local variable is likely to confuse people who read your code. DECTPU will return
an informational message during compilation if a local variable has the same
name as a global variable.
4.6 Constants
DECTPU has three types of constants:
Integers
Strings
Keywords
Integer constants can be any integer value that is valid in DECTPU. See the DEC
Text Processing Utility Reference Manual for more information on the integer data
type.
String constants can be one character or a combination of characters delimited by
apostrophes or quotation marks. See the DEC Text Processing Utility Reference
Manual for a complete description of how to quote strings in DECTPU.
Keywords are reserved words that have special meaning to the DECTPU
compiler. See Chapter 3 for a complete description of keywords.
With the CONSTANT declaration, you can associate a name with a constant
expression. User-defined constants can be locally or globally defined.
A local constant is a constant declared within a procedure declaration. The scope
of the constant is limited to the procedure in which it is defined.
A global constant is a constant declared outside a procedure. Once a global
constant has been defined, it is set for the life of the DECTPU session. You can
reassign to a constant the same value it was assigned previously, but you cannot
redefine a constant during a DECTPU session.
See Section 4.9.5.3 for a complete description of the CONSTANT declaration.
Example 4–2 shows a global constant declaration and a procedure that contains a
local constant declaration.
Example 4–2 Global and Local Constant Declarations
! Define some global constants.
CONSTANT
user_bell := BELL,
user_hello := "Hello",
user_ten := 10;
! Hello world procedure.
(continued on next page)
4–6 Lexical Elements of the DEC Text Processing Utility Language