Database access and manipulation is performed using the data manipulation statements. These statements, which are specifically designed to interact with an Eloquence database, are invoked through Eloquence language programs. These statements are structured so that each one suggests its function (for example, DBGET gets data from a data set). All data access is carried out at the data entry level (this is known as the "full record mode"). Data entries may be accessed in one of five modes: serial, directed, chained, indexed or calculated.
When accessing a data set in serial mode, Eloquence DBMS starts at the most recently accessed record (data entry), called the current record and sequentially examines records until the next, non-empty record is located. This record is then transferred to the data buffer and becomes the new current record. Serial access is often used to examine or list all entries in a data set.
The following example shows entries in the PRODUCT master data set. The record numbers are shown to the left of each entry. The arrows to the left of the record number show how entries will be retrieved in serial mode. If the current record is 4, for example, the next record accessed in serial mode will be record number 5.
Figure 3 A Serial Access of the PRODUCT Master Data Set
A second method of accessing a data entry is directed access. With this method, Eloquence DBMS returns the record specified by a record number supplied by a program. If the specified record is non-empty the record is transferred to the data buffer. If the record is empty a status error is returned. In either case, the current record is set to the record specified. Directed access is used to read entries following a SORT or FIND operation.
The following example shows the retrieval of an entry using directed access. The record number 5, supplied by an application program, instructs Eloquence DBMS to retrieve record 5. Eloquence DBMS then copies the record into the data buffer and resets the current record to 5.
Figure 4 Directed Access of the PRODUCT Master Data Set
Chained access is used to retrieve detail data entries with common search item values. Eloquence DBMS supports chained access in a forward direction. Entries along a data chain may be accessed in a reverse direction, however, by using directed access and the status information returned by Eloquence DBMS. Chained access of detail data sets is often used for retrieving information about related events.
The following example shows the retrieval of detail entries using chained access. The corresponding chain pointer information, maintained by Eloquence DBMS, is shown along with the record number for the data set. Eloquence DBMS uses this pointer information to retrieve the next entry along the chain. The arrows to the left of the record numbers show how entries will be retrieved in chained mode. If the current record is 5, for example, the next record accessed in chained mode will be 7.
Figure 5 Chained Access of the CUSTOMER Detail Data Set
Calculated access is based on a search item value, and may be used to access master data sets only. This access method involves assigning a search item to a data set, where the assignment of search item to data set is carried out by the ISAM software using index files.
The following example shows the retrieval of an entry using calculated access. The search item value 500, which is supplied by an application program, is used by Eloquence DBMS to locate record number 5. The record is copied into the data buffer and the current record is set to 5.
This example also shows two deleted (blank) records. When a record is deleted from a data file, the space taken by that record still remains in the file. When a new record is added, it takes an available space left by a deleted record. If there are no deleted (blank) records, the new record is added to the end of the file.
Figure 6 Calculated Access of the PRODUCT Master Data Set
Indexed access is a further method of accessing individual data set entries or a group of data set entries. It is similar to chained access, but there are differences:
- No master set is required, so indexed access can be used for all data set types.
- Combined search-items are possible (e.g. the first four characters of a name plus date of birth). They don't have to be unique.
- Access via just part of the search-item is possible (e.g., all customers whose names begin with SAM).
- Data can be accessed in sorted form. By default, the index item values are sorted in ASCII sequence, but other collating sequences can be specified at the time the database is created.
Figure 7 Indexed Access
Eloquence Database Manual - 19 DEC 2002