2.2 Term

As with any new concept, there are terms that must be defined as we intend to use them. Keep in mind that our definitions may differ from other definitions you already know.

RMSfile

An RMSfile is a single collection of similar data. An example would be a vendor master file. In this file you collect information about your vendors. This file would not be used to record unrelated data such as customer information. Instead, a different RMSfile is used: a customer master file.

An RMSfile consists of two or three component files: an RMS data file that contains the actual data, an RMS dictionary file that contains information about the fields in the RMSfile, and an optional RMS index file that contains indices for key fields. See Chapter 4, Creating RMSfiles for more information about RMSfiles.

RMS definition file

An RMS definition file is a file that describes the structure of an RMSfile, similar to the RMS dictionary file that is a part of an RMSfile. A RMS definition file is used as a template for creating RMSfiles. See Chapter 4, Creating RMSfiles for more information about RMS definition files.

Formfile

A formfile is a collection of related data entry forms. See Chapter 3, Using Form and Chapter 5, Creating Formfiles for more information about formfiles.

Reportfile

A reportfile describes a report that you can print with the grace (C-1) command. See Chapter 7, Creating Visual Reports and Chapter 9, Report Writer Programming Guide for more information about reportfiles.

Database

A database is a collection of RMSfiles, formfiles, and reportfiles that comprise an application. An example of a database is an accounting system. Some of the files in an accounting database might include a vendor master RMSfile, a customer master RMSfile, an invoice formfile, a check printing reportfile, and so on.

You can have many C/Base databases on the same system. Each database has a name that consists of 1 to 31 alphanumeric characters. The first character should be a letter.

Default Database

The default database names the database to use if a database is not explicitly named.

You can define the default database in one of two ways:

gifs/20000000.gif Set the DBASE to the name of the database as follows:

c:\> set DBASE="dbname"

This technique allows you to design an application that works with several databases of similar structure. The toolkit (C-1), start (C-1), and cbooks (C-1) commands all set the DBASE when they start. To set the default database in the "C" programming language by:

gifs/20000000.gif Call the dbopen library function (see dbopen (C-3) in C/Base Utilities Manual Chapter 8, C/Base Functions for details) as follows:

c:\> dbopen ("dbname");

Pathname

A pathname is a name the operating system uses to refer to a file, for example, \cbase\demo\data\mag. A pathname can be absolute (like the example above) or relative to some directory (in the example above, the pathname data\mag is relative to the directory \cbase\demo).

Logical Name

Every RMSfile, formfile, or reportfile that is part of a database has a logical name that you can use instead of a pathname to refer to the file. You provide a logical name for the file when it is created; the logical name remains constant until the file is removed. The pathname of a file is changed when you move the file, but the logical file name is never changed. You should always use logical names in your application, not the file's pathname. Most commands and library routines accept either the logical name or the pathname of a file.

A logical name is written as:

dbname~logicalname

or

~logicalname

or

logicalname

Logicalname consists of 1 to 31 alphanumeric characters, the first character should be a letter. The tilde character (~) separates the database name from the logical file name, and may not have blanks before or after it. If you leave out dbname, the default database is used. If there is no default database, you must specify dbname. C/Base commands and library functions that accept both logical names and pathnames will return an error if you specify an ambiguous name; i.e., just logicalname (without a ~) and a file exists whose pathname is logicalname.

Logical formfile names, logical reportfile names, and logical RMSfile names must be unique within a database. However, different databases can have the same logical name, and one type of logical file (e.g. RMSfile, formfile, or reportfile) can have the same name as a different type of logical file (e.g. a logical formfile name can be the same as a logical RMSfile name even in the same database).

Database Catalog

The database catalog provides an index, or catalog, of the RMSfiles, formfiles, and reportfiles that make up a database. The database catalog is organized by database names and logical names, and it keeps track of several attributes for each database and logical name (the pathname of a file, for example). The C/Base program looks up logical file names you specify in the database catalog to find the actual pathname of the file.

Transaction Log

A transaction log records all changes made to an RMSfile within a database. Each database can record the changes of one or more of its RMSfiles. All C/Base programs use transaction logging, but logging is normally disabled when creating RMSfiles with toolkit (C-1). See the section at the end of this chapter for more information on transaction logging. If you have the C/Base Utilities package, see C/Base Utilities Manual Chapter 5, Transaction Logging for additional programming information.

Application

An application is a collection of file definitions, data entry forms, reports and menus designed to perform some task. Typically, each application is designed to work with one database.

The C/Base toolkit(C-1) and start(C-1) commands treat applications and databases as synonymous terms. When you create a new application with toolkit, you are also creating a new database whose name matches the application name. Likewise, when you run an application with start, the associated database is established as the default database. To these commands, applications and databases are equivalent.

If you are not using toolkit or start, you can design multiple applications for a single database. You can also use multiple databases within one application.