he Explorer window of the BASIS IDE distinguishes between the various file types that make up a Business BASIC software project.
Type-specific icons and context-sensitive popup menus let you see at a glance exactly what types of files a directory contains
and then select the appropriate operations for each different file. This article describes the new functionality available in
the popup menu of BASIS data files. The Data Viewer provides a convenient way to view the contents of data files. Like the
character-based _browse utility, the Data Viewer does not allow developers
to edit or create data files, but it provides the ability to open and inspect the files in hexadecimal and ASCII format.
Direct integration with the IDE provides an intuitive graphical user interface to a directory of data files and instant
availability of the Data Viewer.
To try out the Data Viewer, first ensure that BBj® Services is running and then mount a directory containing BASIS data files
into the Explorer. Data files have drum-shaped icons with a super-imposed letter that indicates the type of data file: S for Serial files, X for
XKEYED files, I for Indexed files, M for MKEYED, etc.
|
Figure 1. Data Viewer.
Next, select one of the data files and right click to display the popup menu. Figure 1 shows an MKEYED file named CUSTOMER,
from the Chile Company database, selected in the Explorer. It does not make sense to compile or execute this data file in the
IDE, but you can examine it with the View BASIS File operation found at the top of the popup menu.
Selecting the View BASIS File menu item opens the file in the Data Viewer, a special two-tabbed panel loaded in the IDE's
Source Editor. Remember not to confuse the "viewer" with the "editor," even though the Data Viewer appears in the Source
Editor's frame along with the edited program files.
In Figure 2, the Data Viewer shows the opened CUSTOMER file and the File Information tab. The CUSTOMER file contains 68
records of 352 bytes (characters) each. The file includes nine different keys with one unique key. The Source Editor displays
the key definitions following the key number.
|
Figure 2. Data Viewer File Information Tab.
Figure 3 shows the Record/Key Data tab, which allows a record-by-record, one-byte-at-a-time interactive examination of the
file. A slider at the top of the tab moves through an individual record. The BASIS IDE keeps the hexadecimal and ASCII
presentations of the record synchronized as the slider moves back and forth.
The Key Data window in the lower half of the tab shows the hexadecimal and ASCII contents of the nine keys defined in this
file as they apply to the current record. Use the buttons at the bottom of the tab to move between records, or to the first or
last record of the file.
|
Figure 3. Data Viewer Record/Key Data Tab.
The Key Chain combo box controls the sorting of the records when moving between them with the navigation buttons. The number
selected represents the key used to sort the records. Pressing the button to move to the next record displays the next record
in the sorted chain assembled by the selected key, which shows the effectiveness of the defined keys.
The Data Viewer for BASIS data files represents another step in the evolution of our integrated environment for Business BASIC
development. For more information about working with data in the BASIS IDE, see Managing Databases/Data Dictionaries with the
BASIS IDE.
|