BASIS IDE Data File Viewer


The Explorer window of the BASIS IDE provides type-specific icons and context sensitive popup menus to show, at a glance, which file types and operations are available in each mounted directory. Database files have drum-shaped icons with a super-imposed letter indicating the type of file: "S" for serial data files, "X" for XKEYED files, "M" for MKEYED files, etc. The letter "E" identifies encrypted files. A developer cannot edit, compile, or execute Data files like program files, but can examine them using the Data File Viewer accessed from the popup menu.

The Data File Viewer provides a convenient way to view the contents of database files. Like the character-based _browse utility, it does not allow creation or editing of data files, but instead displays their contents in hexadecimal and ASCII. The Data File Viewer uses the BBj Filesystem Server to open and parse database files, which means that BBjServices must be running in order to use it. When BBjServices is not running, a warning dialog announces that the data file is not viewable until a connection to the server is established.

Selecting and Viewing a Data File

Follow these steps to examine a database file in the Data File Viewer:

  1. Start BBjServices and the BASIS IDE.

  2. Mount the directory containing database files into the IDE Explorer.

  3. Select the database file for examination and right click to open the popup menu, as shown below.

  4. Select the View BASIS File menu item to start the Data File Viewer. A dialog appears if the data file is encrypted and prompts for the decryption password before opening the file in the Viewer.


The Data File Viewer is a special three-tabbed panel loaded in the Source Editor frame of the IDE. Even though the Data File Viewer appears in the Source Editor's window along with other edited program files, the Viewer really is a "viewer" and not an "editor." A developer can open multiple database files simultaneously, with each new instance of the Data File Viewer represented by its own tab in the Source Editor window.

The File Information Tab

The figure below shows an MKEYED file called CUSTOMER open in the Data File Viewer. The File Information Tab reports that CUSTOMER has 68 records of 352 bytes (characters) each. There are eight different keys, one of which is unique, with the definitions shown following the key number.


The Record/Key Data Tab

The Record/Key Data tab, shown below, allows record-by-record one-byte-at-a-time interactive examination of the file. A slider control in the upper part of this tab moves back and forth through an individual record while synchronized hexadecimal and ASCII presentations appear above it. The Key Data window in the lower half of the tab shows the hexadecimal and ASCII contents of the eight 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.


The Key Chain combo box controls how the records are sorted when moving between them with the navigation buttons. The number selected represents the key used to sort the records. Pressing a button to move to the next record displays the next record in the sorted chain assembled by the selected key, which shows how effective the defined keys actually are.

The Field Data Tab

The purpose of the Field Data tab is to show how the information in a record is broken out into individual fields. Unlike the File Information and Record/Key Data tabs, the data does not populate this tab automatically when first displayed. As shown below, the tab remains empty until the developer supplies additional information.


Separating record data into fields requires a template, which explains the structure and organization of a record. Record templates are not stored as part of the data file itself, so obtain a template from another source and paste it into the tab's Record Template field. If the file in view belongs to a data dictionary currently mounted in the IDE, obtain the template from the Template field of the Data Dictionary editor's Columns tab. (See BASIS IDE Data Dictionary for more information.) Another good location for a suitable record template is the source code of the program responsible for creating and manipulating the data file. Someone with knowledge of the record structure could also enter the template directly into the field.

Follow these steps to view the fields of a record in the Field Data tab:

  1. Open the file in the Data File Viewer and select the Field Data tab.

  2. Paste in or enter a record template.

  3. Press the Refresh button. If the template is correct, the Field Data table populates with the contents of the record formatted infields.

Follow these steps to view decrypted field information:

  1. Enter the decryption password.

  2. Select a field to decrypt by checking its box in the Decrypt column of the Field Data table.

Assuming a correct password, the decrypted contents of the field appears in the Value column of the Field Data table. Note that the lengths of the encrypted and decrypted content are often different. A red warning message appears if the viewer could not successfully decrypt the field. Like the record template, the encryption password is not stored in the data file itself. The user is responsible for remembering the password or obtaining it from the program source code responsible for creating the data file and encrypting the fields of its records.

In the image below, the Field Data tab shows a record from the CUSTOMER file and the PHONE field selected for decryption.