ASN.1 Value Range Constraints

Value range constraints restrict the possible values that a numeric type can have. Value range constraints can be used only with INTEGER and REAL types.

NOTE: Value range constraints applied to INTEGER types are PER-visible, that is, they affect PER encodings.

Example

In the following example, the possible values of HoursWorked are restricted to be from 0 to 168, inclusive:

HoursWorked           ::= INTEGER (0..168)

The values of HoursPaid are restricted to a range from greater than 0 through 168. The "<" symbol indicates that the lower endpoint value is not included in the legal range:

HoursPaid             ::= INTEGER (0<..168)

The following examples show the use of MIN and MAX. In each case, the legal values of the defined types are restricted to a range which includes the minimum and maximum, respectively, of the parent type. Values of the type ReasonableHours are restricted from 0 to 60, while those of the type LongestHoursWorked must be between 1 and 168:

ReasonableHoursWorked ::= HoursWorked (MIN..60)

LongestHoursWorked    ::= HoursWorked (1..MAX)

Related Topics