Sequence of Operations
Some Btrieve operations can be issued at any time, such as Create (14), Reset (28), and Version (26). However, most Btrieve operations require that you open a file using the Open operation (0). Then, you must establish a position, or currency, in the file before you can operate on any records.
You can establish physical currency (based on physical location in the file) or logical currency (based on a key value).
After you establish currency, you can issue appropriate file I/O operations, such as Insert (2), Update (3), and Delete (4).
*Note: Always use Btrieve operations to perform I/O on Btrieve files; never perform standard I/O on a Btrieve file.
Based on your currency, you can move through the file as follows:
You cannot establish physical currency with one operation and then follow with an operation that requires logical currency. For example, you cannot issue a Step First operation and then a Get Next operation.
In data-only files, the MicroKernel does not maintain or create any index pages. You can access the records using only the Step operations and the Get Direct/Record operation (23), all of which use the physical location to find records.
In key-only files, the MicroKernel does not maintain or create any data pages. You can access records using only the Get operations, which use logical currency to find records.
When you have finished working with a file, use the Close operation (1) to close it. When your application is ready to terminate, issue a Stop operation (25).
*Note: Failure to perform a Stop operation prevents the MicroKernel from returning its resources to the operating system. This failure eventually results in unpredictable system behavior, including the possibility of crashing the computer on which the application is running.