Next: , Previous: , Up: Constraints on Record Sets   [Contents][Index]


7.5 Size Constraints

Sometimes it is desirable to place constraints on entire records. This can be done with the %size special field which is used to limit the number of records in a record set. Its usage is:

%size: [relational_operator] number

If no operator is specified then number is interpreted as the exact number of records of this type. The number can be any integer literal, including hexadecimal and octal constants. For example:

%rec: Day
%size: 7
%type: Name enum
+ Monday Tuesday Wednesday Thursday Friday
+ Saturday Sunday
%doc: There should be exactly 7 days.

The optional relational_operator shall be one of <, <=, > and >=. For example:

%rec: Item
%key: Id
%size: <= 100
%doc: We have at most 100 different articles.

It is valid to specify a size of 0, meaning that no records of this type shall exist in the file.

Only one %size field shall appear in a record descriptor.