<< Click to Display Table of Contents >> Navigation: Reference > Commands > D (define) |
See also the M (make) and Z (zero) commands.
The D (define) command takes one of the forms:
D col = definition,
D field = definition,
D spreadfield = definition,
DC cvar = definition,
DI ivar = definition,
DJ ivar = definition,
DM mvar= definition,
DS svar= definition,
DW wvar = definition,
The D (define) command creates variables from the data . The definition can take many different forms described below.
Variables may be defined more than once (as long as the definition does not alter the type or length of the variable). When this happens, the new value assigned replaces the old value. Note that a variable may be redefined in terms of itself to accumulate values in a variable.
Variables defined may be any type. The letter after the command tells CL which kind of variable is being defined.
The first definition of a variable may be a "dummy definition", for which a special form of syntax is used:
DC cvar (n),
DM mvar (n),
DS svar (n),
DI ivar,
DJ ivar,
DW wvar,
In this case no executable code is generated, but space is allocated for the variable, and it remains empty until a definition is encountered. The notation (n) above refers to the number of bits or characters in the variable.
A variable has the value zero, or empty, until it is assigned a value.
Particular care should be taken when testing cvars that have been defined with dummy definitions, or zeroed; 'zero' is not always equivalent to 'blank'.
Cols, fields and spreadfields may be replaced using the D command. This is useful when using the PUNCH command to generate a new data set.
The following sections describe the permissible forms of definition.