You can define global variables only with DECLARE statements
entered in response to the DTR> prompt of DEC DATATRIEVE command
level.
You can use a global variable as a value expression in any DEC
DATATRIEVE statement. Unless you define a global variable with
a COMPUTED BY clause, the global variable retains the value you
assign to it until you either assign it a new value or release it
with the RELEASE command.
The value of a global variable defined with a COMPUTED BY clause
depends on the value expression that controls the computation.
For example, you can declare the value of the variable to be 1.2
times the price of a boat in the YACHTS domain. The value of the
variable changes according to the value of the PRICE field for
different records:
DTR> READY YACHTS
DTR> DECLARE VAR COMPUTED BY PRICE * 1.2.
DTR> FOR FIRST 5 YACHTS PRINT VAR USING $$$,$$$.99
VAR
$44,341.20
$21,480.00
$33,000.00
$22,320.00
$11,874.00
DTR>