One of the most powerful features of NDBs is the use of null fields, an understanding of which is essential to the effective use of an NDB.
An NDB is a field-oriented database. Data is always accessed by field name. Other databases may have the concept of a record or group, being a collection of fields, that can be accessed by the name of the record or group. An NDB record is the actual, complete record, as logically accessed by RID.
At first, then, it might seem that an NDB can contain only one record-type, where record-type corresponds to a supplier, an order, or a customer record, for example. This is not the case. In fact, an NDB can contain almost any number of logical record types, each of which can be accessed separately. To achieve this, an NDB uses the concept of the null field. A null field is simply a defined field that is not present in a record.
The number of defined fields in the control record includes the number of null fields and each null field has a field definition record. However, the field is not physically present in the record. This is clearly not the same as a field that is present, but contains a null value (for example, blank).
Even if the field is defined as keyed, a null field is never keyed. Thus, any attempt to access by using keys will never retrieve a record that has that field null.
For any data format, a field can have one of the following logical values:
In NCL terms, the following statements illustrate the three states of a field:
Sets &VALUE to not-present (the actual variable is deleted from the NCL procedure's variable pool).
Sets &VALUE to present, with the value of one blank.
Sets &VALUE to present, with the value of value.
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |