RSNs and AA Values as Keys
If DBEngine does not find a suitable index, the Client tries to use the RSN (record sequence number) or the AA Value (absolute address) of the records as the key. Both of these items are A-Series words (48-bit quantities). They are passed to the Client as part of the record header. Both use the same entry in the header, and DBEngine informs the client about what this item represents, as explained below. If the Client decides to use one of these quantities as the key, the set_name column is set to aa_set in the DATASETS client control table. Otherwise, this column is left blank, indicating that there is no set usable as an index.
The DATABridge Client can represent AA Values (or RSNs) the following ways:
RSNs are unique serial numbers that get assigned to records when they get created and remain associated with the record for the life of the record. You must have DMSII XE to be able to use RSNs. Furthermore, you must explicitly enable RSNs in the DASDL. If you explicitly add a column to a data set whose value is the RSN, the DATABridge Client will allow you to use this column as an RSN rather than a REAL. In such cases you should create a composite key that uses the column containing the RSN as the key. Furthermore, you should set the di_option bit DIOPT_Clone_as_RSN in the corresponding DMS_ITEMS table entry to make the client treat this item (which will be a REAL) as an RSN. See DMS_ITEMS.
AA values are the absolute address (that is, the file address — offset within the file — of the records in the data set). They do not remain constant over time; however, in the following cases, AA_values are required to implement foreign keys to link records in related data sets:
Not all data sets have valid AA values; for example, ORDERED and COMPACT data sets do not have valid AA values. When AA values are used as the key, the set_name column of the DATASETS client control table is set to the name "aa_set". The name "aa_set" causes the RSN or the AA value to be used as part of the index using a column named my_rsn or my_aa depending on whether this is an RSN or an AA Value.
To find out if a data set has an RSN or a valid AA value, you need to look at the misc_flags column of the entry for the data set in the DATASETS client control table. The bit DSFLG_Static_AA (bit mask 64) is used to indicate whether the client is using an RSN or an AA Value (1 indicates RSN and 0 indicates AA Value). The bit DSFLG_Valid_AA (bit mask 128) is used to indicate whether or not the data set has a valid AA value (1 indicates a valid AA value). The client has no control over the selection of RSNs versus AA Values. This decision is made by DBEngine.
The advantage of using the AA value to generate a unique key is that it makes updates possible for data sets that could not otherwise be updated; however, this value is not an absolute constant. Any DMSII reorganization (record conversion, file format, or garbage collection) changes these values. When the AA values change, you must reclone all data sets that use the AA value as a key. Therefore, it is recommended that you consider creating a unique composite key rather than using AA values.
The DATABridge Client recognizes the names "aa_set", "user_set", and "pk_set" as special names (the use of the underscore is not allowed in DMSII names).