Introduction

Language Structure

IB Statements

File System

Comet 32 Runtime

Index

Usefiles

Usefiles are sections of an Internet Basic source program that are intended to be merged into main programs at compile time. In a way, usefiles are similar to subroutine source code libraries in other computer languages, and "include" libraries in some data base packages.

In an application system, for example, a definition of the fields and format for a particular data file will be used in all of the programs reading and/or writing that file. It is therefore more practical to include the field and format definitions in a single source file (called a usefile). This single source file may then be merged into the object program at compilation time.

The following diagram shows how usefiles are used. The main source program is written with the assumption that various usefiles exist. These usefiles could contain data definitions, formatting commands, processing routines, etc. When the main program is compiled, the usefiles are merged into the main program. The resulting object program contains the definitions, format commands, and instructions from the main program and all of the usefiles called.

   -----------------------                ----------------
   |   Main source file  |                | Usefile 1    |
   |                     |                |              |
   |                     |<---------------|              |
   |                     |                |              |
   |                     |                |              |
   |                     |                ----------------
   |                     |
   |                     |                ----------------
   |                     |                | Usefile 2    |
   |                     |                |              |
   |                     |<---------------|              |
   |                     |                |              |
   |                     |                |              |
   -----------------------                ----------------
Usefiles are created the same way as source files.

To merge a usefile into the main object program, you must include a USE directive in the main source program.

The USE directive is an alias for the INCLUDE directive.