Creating a data file is easy. D3 files are created by specifying size in terms of frames, or groups. This file size is known as the primary file space, and it is a contiguous section of data on the disk. The size of the file is known as the modulo, and it should always be a prime number.
To create a data file, the command syntax is:
create-file filename dict-modulo data-modulo |
filename |
Is the (combination dictionary and data sections) name of the data file and should easily identify the contents of the file, such as customers, purchase order codes, inventory, and so on. Filenames can be up to 48 characters long. |
dict-modulo |
Is the size of the dictionary section in frames, as a prime number integer and is the number of frames to use in creating the dictionary section of the file. Since each frame is 2000 bytes, it is necessary to know how many bytes are used to store all the attribute-defining items for this file. Typical attribute-defining items use from 50 to 200 characters apiece. In this case, each frame holds about ten to 40 attribute-defining items. |
data-modulo |
Is the size of the data section in frames, as a prime number integer and is the number of frames to use in creating the data section of the file. Since each frame is 2000 bytes, it is necessary to know how many attributes are stored per item, the average number of characters of each attribute, and how many items are stored. NOTE—The prime {number} command can be used to calculate the nearest prime number to your estimated figure. |
To create the most efficiently-sized file:
When a file is created, the size of the dictionary modulo and data modulo must be provided. These frames are set aside for the file, even though it is empty. No other file may access this space.
The D3 file system is structured such that if the file is too small, or if the file grows beyond its original estimated size, the file automatically enlarges the file by adding overflow frames to it. The system still operates normally, but it takes more time to read overflow frames than it does to read primary file space frames, so the idea is to keep as much data in the primary file space as possible. Do this by specifying a properly sized data modulo. An undersized file uses more overflow frames and performs more slowly. An oversized file wastes disk space.
Some files are structured so the average size of an item is larger than 1720 bytes. When an item is created that is larger than 1720 bytes, an automatic override takes place, and the item is not written to the primary file space. Instead, the item is placed entirely in overflow frames, and a pointer item is created in the primary file space, and it points to the overflow frames. This scheme improves ordinary search and sort operations performed on the file.
Specifying the proper file size exactly is not as critical as it seems. D3 has a routine called resize that examines a file, determines proper file size, and automatically resizes the file.
To create attribute-defining items:
Create attribute-defining items that define the contents of each attribute.
Determine the kinds of data that needs to be stored
Consider how data is stored in the system
Consider how data is displayed on output
Name each attribute
To modify the file-defining item:
Once all the attribute-defining items are created, modify the file-defining item:
Modify the macro attribute to list all the attribute names in the desired order.
Modify the correlative attribute to add any bridges, item-ID assignments or called FlashBASIC subroutines.
To create indexes:
Now that the file is created and the attributes are defined, create the indexes for the attributes with:
create-index filename a-code |
To enter data:
The setup is now ready for data entry. Invoke the Update Processor by entering:
U filename {item-ID} |
See Also