VMS Help
PASCAL, Data Types, Ordinal, Subrange

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  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 systems, you can specify the  size  of  INTEGER
  and  UNSIGNED subranges to be larger than 32-bits, but less than
  or equal to 64-bits.  For example:

     TYPE $BIT43=[BIT(43)]0..8796093022208;
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.