A subrange type is user-defined and specifies a limited portion
of another ordinal type (called the base type). The subrange
syntax indicates the lower and upper limits of the type.
Syntax:
lower-bound..upper-bound
The 'lower-bound' is a constant expression or a formal
discriminant identifier that establishes the lower limit of the
subrange.
The 'upper-bound' is a constant expression or a formal
discriminant identifier that establishes the upper limit of the
subrange. The value of the upper bound must be greater than or
equal to the value of the lower bound.
The base type can be any enumerated or predefined ordinal type.
The values in the subrange type appear in the same order as they
are in the base type. For instance, the result of the ORD
function applied to a value of a subrange type is the ordinal
value that is associated with the relative position of the value
in the base type, not in the subrange type.
You can use a subrange type anywhere in a program that its base
type is legal. A value of a subrange type is converted to a
value of its base type before it is used in an operation. All
rules that govern the operations performed on an ordinal type
pertain to subranges of that type.
Example: TYPE
Day = ( Mon, Tues, Wed, Thurs, Fri, Sat, Sun );
Weekday = Mon..Fri; {subrange of base type Day}
Digit = '0'..'9'; {subrange of base type CHAR}
Month = 1 .. 31; {subrange of base type INTEGER}
On OpenVMS Alpha and OpenVMS I64 systems, you cannot specify the
size of INTEGER and UNSIGNED subranges to be larger than 32-bits
eventhough such values would be legal in executable statements.
For example:
TYPE S = 0..8796093022208;
is not supported, while
VAR S : INTEGER64;
BEGIN
S := 8796093022208
END
is legal.