Introduction MTB Statements File System Compiler Applications Reference Guide Index

Overview Creating MTB Source Programs Compiling MTB Programs Compiler Directives Special Characters

Overview of the MTB Compiler

MTB is a compiler language. As such, MTB programs must be written in source form, then compiled into object (machine language) format. The translation process is accomplished with the MTB compiler.

Once a program has been compiled into its object form, only the object is required in order to run the program. The source is not required unless changes are made to the program. In that case, the changes are made in the source program and the source program is re-translated into a new version of the object program.


Creating MTB Source Programs

MTB source programs are created in one of two ways. While working in the Comet environment, the Comet editor utility (a program named CED) may be used to create an MTB source program. Outside of the Comet environment, virtually any text editor or word processor may be used to create an MTB source program.

The MTB compiler recognizes Comet editor files and text files as source files, so feel free to choose the editing method you prefer.

The CED program creates a Comet keyed file with a record size of 94 bytes and key size of 7 bytes. The data records contains MTB statements (up to 80 bytes) followed by an exclamation mark and 7 bytes representing the editor line number. The associated key contains the editor line number as well.

Source programs created outside of the Comet environment are created as "text" files. In this case, the compiler reads up to 132 characters per source line. Note: If you create your MTB source programs as text files, you must register them in the Comet directory file (QDIR) before you compile the program. Refer to the DIRMAINT utility program for additional information.

Many MTB programs employ a convenient feature of the MTB compiler, the inclusion of compiler commands in the source program itself. Therefore, some of the examples in this documentation include lines at the beginning of the program -- commands that are processed by the MTB compiler during the compilation of the program.

Also see Compiling MTB Programs.


Compiling MTB Programs

Interactive Mode
Command Mode

Once an MTB source program has been created, the MTB compiler is used to translate this program to object language. The MTB compiler may be used in interactive mode or with the special compiler commands mentioned earlier.

Note: We recommend that you adopt a naming convention for source files and object files. The most common convention is to choose a unique prefix character for all source files and a different unique prefix character for all object files. That way, program names will be easier to remember and locate in a directory listing containing many files.

For instance, you could choose the letter "X" as a prefix character for your source programs. In that case you would have unique, but similar, names for your source and object programs. For example:

  Source name    Object name
  ==========================       
  XTEST          TEST
  XREPORT        REPORT
  XMENU          MENU
  XMAINT         MAINT


Also see Conditional Compilation and Compiler Directives.


Overview of the MTB Compiler