Once defined, adding records to objects containing ASN will increment the corresponding field by one, starting from the initialized value. In fact, the first record added in this way will have the initialized value, the second this value plus one, and so on.
An ASN field is always required. By default, all ASN are enabled. However, they can be disabled and enabled again any time using the command SET SEQUENCENUMBER. In such a way, the field containing the ASN is treated this way:
- if ASN is enabled, the corresponding value of the field will always contain the ASN, even if direct or indirect assignments are provided for this field. The last value used in any ASN can be retrieved using the function $ZIMSeqNum;
- if ASN is disabled, its field has all normal properties defined by ZIM. The Required attribute, however, remains “yes”. Default value and direct or indirect assignments are applied according to ZIM rules. During the time the ASN is disabled, the automatic sequencing is not accomplished and, as soon as it is enabled again, the sequencing resumes from the point where it has stopped.
The ASN are implemented via a special file called “sequence.zim” in the database path. This file should not be touched unless using DC or the command SET SEQUENCENUMBER.
During normal operation, the execution of an ADD command over an object that contains an ASN will always return the ASN itself or the $Null value whenever an error is detected (these errors are always caused by the corresponding file handling). ASN never raise a deadlock condition. However, if in the course of the ADD processing or in the course of the transaction processing where the ADD is located a deadlock or an error condition is raised which causes the transaction to be terminated, the acquired ASNs are lost. Upon restarting the transaction, new ASN will be taken.