Repeating Fields and Groups with OCCURS

OCCURS and OCCURS DEPENDING ON are fairly simple concepts. The simply indicate how many times a field type, or group of field types, will repeat themselves in the record.

A classic example is a record containing invoices. Instead of having a normalized set of tables/files, one for invoice header data and one for the lines of the invoice keyed by the invoice number or some other foriegn key, there is just a single row with the invoice line group OCCURing a certain number of times.

This can be a static number with the OCCURS statement or can be a dynamic range that dependent on the value found within another field with the OCCURS DEPENDING ON statement.