Sequences are database objects that provide incremental values to an application. They can generate sequential values within any range of an ABL integer (–2,147,483,648 to 2,147,483,647) and with your choice of increment (positive or negative).
You can also define sequences to cycle or terminate when a specified limit is reached. A cycling sequence restarts after it reaches the specified limit, providing non-unique values for the life of the sequence. A terminating sequence stops incrementing after it reaches the specified limit, providing unique values for the life of the sequence as long as you do not explicitly reset it.
Using a sequence, for example, you can generate a unique series of key values automatically. ABL allows you to guarantee that the key value is unique (for terminating sequences) and created in a specified order. You can also use a sequence to generate an audit trail that creates sequential audit records in the same order they are written to the database.
You can also perform the same kinds of operations by using a control table instead of sequences. A control table is a database table that contains a single record with one or more fields. Each field holds a piece of control information such as the name of the application, the company that owns the application, and the last-used value for each unique integer ID in the database. For example, the control table might have fields that hold the last Customer number used and the last order number used. Each time a new Customer record is created, the record is read from the control table and the last Customer number is incremented. This number is then used in the new Customer record.